From 3b3bb8d3bab29ff1bb7314367dfb850789339196 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Mon, 20 Jan 2020 11:37:15 +0100 Subject: [PATCH] New upstream version 1.10.0+dfsg --- .azure-pipelines.yml | 183 - .ci/azure-pipelines/build-macos.yml | 57 + .ci/azure-pipelines/build-ubuntu-16-04.yaml | 52 + .ci/azure-pipelines/build-ubuntu-19-10.yaml | 53 + .ci/azure-pipelines/build-windows.yml | 48 + .ci/azure-pipelines/documentation.yml | 50 + .ci/azure-pipelines/formatting.yml | 31 + .ci/azure-pipelines/tutorials.yml | 44 + .ci/scripts/build_tutorials.sh | 123 + .clang-format | 23 + .dev/docker/doc/Dockerfile | 13 + .dev/docker/env/Dockerfile | 42 + .dev/docker/fmt/Dockerfile | 11 + .dev/format.sh | 34 + .github/issue_template.md | 2 +- 2d/CMakeLists.txt | 71 +- 2d/include/pcl/2d/convolution.h | 207 +- 2d/include/pcl/2d/edge.h | 533 +- 2d/include/pcl/2d/impl/convolution.hpp | 156 +- 2d/include/pcl/2d/impl/edge.hpp | 559 +- 2d/include/pcl/2d/impl/kernel.hpp | 351 +- 2d/include/pcl/2d/impl/keypoint.hpp | 198 +- 2d/include/pcl/2d/impl/morphology.hpp | 279 +- 2d/include/pcl/2d/kernel.h | 399 +- 2d/include/pcl/2d/keypoint.h | 61 +- 2d/include/pcl/2d/morphology.h | 320 +- 2d/src/examples.cpp | 63 +- CHANGES.md | 403 + CMakeLists.txt | 281 +- CONTRIBUTING.md | 13 +- PCLConfig.cmake.in | 305 +- PCLConfigVersion.cmake.in | 2 +- README.md | 55 +- apps/3d_rec_framework/CMakeLists.txt | 197 +- .../feature_wrapper/global/crh_estimator.h | 23 +- .../feature_wrapper/global/cvfh_estimator.h | 15 +- .../feature_wrapper/global/esf_estimator.h | 13 +- .../feature_wrapper/global/global_estimator.h | 19 +- .../global/ourcvfh_estimator.h | 19 +- .../feature_wrapper/global/vfh_estimator.h | 13 +- .../local/colorshot_local_estimator.h | 13 +- .../local/fpfh_local_estimator.h | 21 +- .../local/fpfh_local_estimator_omp.h | 15 +- .../feature_wrapper/local/local_estimator.h | 130 +- .../local/shot_local_estimator.h | 19 +- .../local/shot_local_estimator_omp.h | 25 +- .../feature_wrapper/normal_estimator.h | 41 +- .../3d_rec_framework/pc_source/mesh_source.h | 60 +- .../pc_source/registered_views_source.h | 76 +- .../apps/3d_rec_framework/pc_source/source.h | 70 +- .../pipeline/global_nn_classifier.h | 41 +- .../pipeline/global_nn_recognizer_crh.h | 40 +- .../pipeline/global_nn_recognizer_cvfh.h | 73 +- .../pipeline/impl/global_nn_classifier.hpp | 41 +- .../impl/global_nn_recognizer_crh.hpp | 67 +- .../impl/global_nn_recognizer_cvfh.hpp | 99 +- .../pipeline/impl/local_recognizer.hpp | 72 +- .../pipeline/local_recognizer.h | 52 +- .../tools/openni_frame_source.h | 17 +- .../pcl/apps/3d_rec_framework/utils/metrics.h | 25 +- .../utils/persistence_utils.h | 30 +- .../utils/vtk_model_sampling.h | 21 +- .../tools}/global_classification.cpp | 64 +- .../tools}/local_recognition_mian_dataset.cpp | 194 +- .../src/tools/openni_frame_source.cpp | 11 +- apps/3d_rec_framework/tools/CMakeLists.txt | 1 - .../tools/apps/CMakeLists.txt | 10 - apps/CMakeLists.txt | 351 +- apps/cloud_composer/CMakeLists.txt | 348 +- apps/cloud_composer/ComposerTool.cmake | 37 +- .../pcl/apps/cloud_composer/cloud_browser.h | 34 +- .../pcl/apps/cloud_composer/cloud_composer.h | 12 +- .../pcl/apps/cloud_composer/cloud_view.h | 27 +- .../pcl/apps/cloud_composer/cloud_viewer.h | 13 +- .../pcl/apps/cloud_composer/commands.h | 110 +- .../apps/cloud_composer/impl/cloud_item.hpp | 9 +- .../cloud_composer/impl/merge_selection.hpp | 10 +- .../cloud_composer/impl/transform_clouds.hpp | 6 +- .../pcl/apps/cloud_composer/item_inspector.h | 30 +- .../items/cloud_composer_item.h | 43 +- .../apps/cloud_composer/items/cloud_item.h | 50 +- .../pcl/apps/cloud_composer/items/fpfh_item.h | 28 +- .../apps/cloud_composer/items/normals_item.h | 28 +- .../pcl/apps/cloud_composer/merge_selection.h | 20 +- .../click_trackball_interactor_style.h | 31 +- .../point_selectors/interactor_style_switch.h | 37 +- .../point_selectors/manipulation_event.h | 12 +- .../rectangular_frustum_selector.h | 19 +- .../selected_trackball_interactor_style.h | 47 +- .../point_selectors/selection_event.h | 20 +- .../pcl/apps/cloud_composer/project_model.h | 27 +- .../apps/cloud_composer/properties_model.h | 21 +- .../include/pcl/apps/cloud_composer/qt.h | 75 - .../apps/cloud_composer/signal_multiplexer.h | 25 +- .../tool_interface/abstract_tool.h | 69 +- .../tool_interface/tool_factory.h | 8 +- .../pcl/apps/cloud_composer/toolbox_model.h | 29 +- .../tools/euclidean_clustering.h | 47 +- .../cloud_composer/tools/fpfh_estimation.h | 48 +- .../tools/impl/organized_segmentation.hpp | 29 +- .../cloud_composer/tools/impl/supervoxels.hpp | 20 +- .../cloud_composer/tools/normal_estimation.h | 47 +- .../tools/organized_segmentation.h | 48 +- .../cloud_composer/tools/sanitize_cloud.h | 47 +- .../tools/statistical_outlier_removal.h | 46 +- .../apps/cloud_composer/tools/supervoxels.h | 48 +- .../tools/voxel_grid_downsample.h | 47 +- .../apps/cloud_composer/transform_clouds.h | 20 +- .../pcl/apps/cloud_composer/work_queue.h | 11 +- apps/cloud_composer/src/cloud_browser.cpp | 2 +- apps/cloud_composer/src/cloud_composer.cpp | 9 +- apps/cloud_composer/src/cloud_view.cpp | 19 +- apps/cloud_composer/src/cloud_viewer.cpp | 8 +- apps/cloud_composer/src/commands.cpp | 55 +- apps/cloud_composer/src/item_inspector.cpp | 14 +- .../src/items/cloud_composer_item.cpp | 14 +- apps/cloud_composer/src/items/cloud_item.cpp | 41 +- apps/cloud_composer/src/items/fpfh_item.cpp | 23 +- .../cloud_composer/src/items/normals_item.cpp | 10 +- apps/cloud_composer/src/main.cpp | 4 +- apps/cloud_composer/src/merge_selection.cpp | 12 +- .../click_trackball_interactor_style.cpp | 2 +- .../interactor_style_switch.cpp | 10 +- .../point_selectors/manipulation_event.cpp | 4 +- .../rectangular_frustum_selector.cpp | 35 +- .../selected_trackball_interactor_style.cpp | 47 +- .../src/point_selectors/selection_event.cpp | 4 +- apps/cloud_composer/src/project_model.cpp | 120 +- apps/cloud_composer/src/properties_model.cpp | 34 +- .../cloud_composer/src/signal_multiplexer.cpp | 11 +- apps/cloud_composer/src/toolbox_model.cpp | 27 +- apps/cloud_composer/src/transform_clouds.cpp | 8 +- apps/cloud_composer/src/work_queue.cpp | 3 +- .../tools/euclidean_clustering.cpp | 12 +- apps/cloud_composer/tools/fpfh_estimation.cpp | 13 +- .../tools/normal_estimation.cpp | 10 +- .../tools/organized_segmentation.cpp | 8 +- apps/cloud_composer/tools/sanitize_cloud.cpp | 9 +- .../tools/statistical_outlier_removal.cpp | 10 +- apps/cloud_composer/tools/supervoxels.cpp | 12 +- .../tools/voxel_grid_downsample.cpp | 10 +- apps/in_hand_scanner/CMakeLists.txt | 140 +- .../include/pcl/apps/in_hand_scanner/boost.h | 13 +- .../pcl/apps/in_hand_scanner/common_types.h | 31 +- .../include/pcl/apps/in_hand_scanner/eigen.h | 5 +- .../pcl/apps/in_hand_scanner/help_window.h | 8 +- .../include/pcl/apps/in_hand_scanner/icp.h | 44 +- .../in_hand_scanner/impl/common_types.hpp | 8 +- .../apps/in_hand_scanner/in_hand_scanner.h | 102 +- .../in_hand_scanner/input_data_processing.h | 50 +- .../pcl/apps/in_hand_scanner/integration.h | 62 +- .../pcl/apps/in_hand_scanner/main_window.h | 15 +- .../apps/in_hand_scanner/mesh_processing.h | 12 +- .../in_hand_scanner/offline_integration.h | 76 +- .../pcl/apps/in_hand_scanner/opengl_viewer.h | 108 +- .../include/pcl/apps/in_hand_scanner/utils.h | 5 +- .../in_hand_scanner/visibility_confidence.h | 17 +- apps/in_hand_scanner/src/icp.cpp | 43 +- apps/in_hand_scanner/src/in_hand_scanner.cpp | 37 +- .../src/input_data_processing.cpp | 7 +- apps/in_hand_scanner/src/integration.cpp | 30 +- apps/in_hand_scanner/src/main.cpp | 2 +- .../src/main_offline_integration.cpp | 2 +- apps/in_hand_scanner/src/mesh_processing.cpp | 7 +- .../src/offline_integration.cpp | 39 +- apps/in_hand_scanner/src/opengl_viewer.cpp | 70 +- .../src/visibility_confidence.cpp | 12 +- .../pcl/apps/dominant_plane_segmentation.h | 28 +- .../face_detection_apps_utils.h | 42 +- .../apps/face_detection/openni_frame_source.h | 17 +- .../apps/impl/dominant_plane_segmentation.hpp | 36 +- apps/include/pcl/apps/manual_registration.h | 23 +- apps/include/pcl/apps/nn_classification.h | 55 +- apps/include/pcl/apps/openni_passthrough.h | 13 +- apps/include/pcl/apps/openni_passthrough_qt.h | 5 +- .../pcl/apps/organized_segmentation_demo.h | 51 +- .../pcl/apps/organized_segmentation_demo_qt.h | 5 +- apps/include/pcl/apps/pcd_video_player.h | 11 +- .../pcl/apps/render_views_tesselated_sphere.h | 15 +- apps/include/pcl/apps/timer.h | 5 +- apps/include/pcl/apps/vfh_nn_classifier.h | 41 +- apps/modeler/CMakeLists.txt | 231 +- .../include/pcl/apps/modeler/abstract_item.h | 9 +- .../pcl/apps/modeler/abstract_worker.h | 11 +- .../pcl/apps/modeler/channel_actor_item.h | 22 +- .../include/pcl/apps/modeler/cloud_mesh.h | 15 +- .../pcl/apps/modeler/cloud_mesh_item.h | 33 +- .../apps/modeler/cloud_mesh_item_updater.h | 8 +- .../include/pcl/apps/modeler/dock_widget.h | 15 +- .../apps/modeler/icp_registration_worker.h | 25 +- .../pcl/apps/modeler/impl/scene_tree.hpp | 10 +- .../include/pcl/apps/modeler/main_window.h | 21 +- .../apps/modeler/normal_estimation_worker.h | 24 +- .../pcl/apps/modeler/normals_actor_item.h | 32 +- .../include/pcl/apps/modeler/parameter.h | 116 +- .../pcl/apps/modeler/parameter_dialog.h | 36 +- .../pcl/apps/modeler/points_actor_item.h | 32 +- .../include/pcl/apps/modeler/poisson_worker.h | 25 +- apps/modeler/include/pcl/apps/modeler/qt.h | 91 - .../include/pcl/apps/modeler/render_window.h | 16 +- .../pcl/apps/modeler/render_window_item.h | 24 +- .../include/pcl/apps/modeler/scene_tree.h | 25 +- .../statistical_outlier_removal_worker.h | 25 +- .../pcl/apps/modeler/surface_actor_item.h | 44 +- .../pcl/apps/modeler/thread_controller.h | 9 +- .../modeler/voxel_grid_downsample_worker.h | 25 +- apps/modeler/src/abstract_item.cpp | 7 +- apps/modeler/src/abstract_worker.cpp | 15 +- apps/modeler/src/channel_actor_item.cpp | 3 +- apps/modeler/src/cloud_mesh.cpp | 42 +- apps/modeler/src/cloud_mesh_item.cpp | 15 +- apps/modeler/src/cloud_mesh_item_updater.cpp | 2 +- apps/modeler/src/icp_registration_worker.cpp | 12 +- apps/modeler/src/main.cpp | 3 +- apps/modeler/src/main_window.cpp | 15 +- apps/modeler/src/normal_estimation_worker.cpp | 8 +- apps/modeler/src/normals_actor_item.cpp | 10 +- apps/modeler/src/parameter.cpp | 7 +- apps/modeler/src/parameter_dialog.cpp | 37 +- apps/modeler/src/points_actor_item.cpp | 8 +- apps/modeler/src/poisson_worker.cpp | 4 +- apps/modeler/src/render_window.cpp | 8 +- apps/modeler/src/render_window_item.cpp | 3 +- apps/modeler/src/scene_tree.cpp | 89 +- .../statistical_outlier_removal_worker.cpp | 4 +- apps/modeler/src/surface_actor_item.cpp | 10 +- apps/modeler/src/thread_controller.cpp | 6 +- .../src/voxel_grid_downsample_worker.cpp | 6 +- apps/modeler/tools/CMakeLists.txt | 2 - apps/optronic_viewer/CMakeLists.txt | 108 - .../pcl/apps/optronic_viewer/cloud_filter.h | 449 - .../pcl/apps/optronic_viewer/filter_window.h | 120 - .../pcl/apps/optronic_viewer/main_window.h | 174 - .../pcl/apps/optronic_viewer/openni_grabber.h | 88 - .../include/pcl/apps/optronic_viewer/qt.h | 101 - apps/optronic_viewer/src/cloud_filter.cpp | 662 -- apps/optronic_viewer/src/filter_window.cpp | 168 - apps/optronic_viewer/src/main.cpp | 50 - apps/optronic_viewer/src/main_window.cpp | 500 -- apps/optronic_viewer/src/openni_grabber.cpp | 84 - apps/point_cloud_editor/CMakeLists.txt | 212 +- .../pcl/apps/point_cloud_editor/cloud.h | 17 +- .../point_cloud_editor/cloudEditorWidget.h | 38 +- .../point_cloud_editor/cloudTransformTool.h | 12 +- .../pcl/apps/point_cloud_editor/command.h | 4 +- .../apps/point_cloud_editor/commandQueue.h | 6 +- .../pcl/apps/point_cloud_editor/common.h | 5 +- .../pcl/apps/point_cloud_editor/copyBuffer.h | 26 +- .../pcl/apps/point_cloud_editor/copyCommand.h | 43 +- .../pcl/apps/point_cloud_editor/cutCommand.h | 38 +- .../apps/point_cloud_editor/deleteCommand.h | 45 +- .../apps/point_cloud_editor/denoiseCommand.h | 42 +- .../point_cloud_editor/denoiseParameterForm.h | 10 +- .../pcl/apps/point_cloud_editor/localTypes.h | 62 +- .../pcl/apps/point_cloud_editor/mainWindow.h | 4 +- .../apps/point_cloud_editor/pasteCommand.h | 37 +- .../apps/point_cloud_editor/select1DTool.h | 12 +- .../apps/point_cloud_editor/select2DTool.h | 12 +- .../pcl/apps/point_cloud_editor/selection.h | 34 +- .../selectionTransformTool.h | 12 +- .../pcl/apps/point_cloud_editor/statistics.h | 5 +- .../point_cloud_editor/statisticsDialog.h | 9 +- .../apps/point_cloud_editor/toolInterface.h | 4 +- .../pcl/apps/point_cloud_editor/trackball.h | 5 +- .../point_cloud_editor/transformCommand.h | 38 +- apps/point_cloud_editor/src/cloud.cpp | 19 +- .../src/cloudEditorWidget.cpp | 38 +- .../src/cloudTransformTool.cpp | 4 +- apps/point_cloud_editor/src/commandQueue.cpp | 2 +- apps/point_cloud_editor/src/copyBuffer.cpp | 19 +- apps/point_cloud_editor/src/cutCommand.cpp | 6 +- apps/point_cloud_editor/src/deleteCommand.cpp | 4 +- .../point_cloud_editor/src/denoiseCommand.cpp | 5 +- apps/point_cloud_editor/src/main.cpp | 2 +- apps/point_cloud_editor/src/pasteCommand.cpp | 4 +- apps/point_cloud_editor/src/select1DTool.cpp | 2 +- apps/point_cloud_editor/src/select2DTool.cpp | 8 +- apps/point_cloud_editor/src/selection.cpp | 7 +- .../src/selectionTransformTool.cpp | 16 +- apps/point_cloud_editor/src/statistics.cpp | 13 +- apps/point_cloud_editor/src/trackball.cpp | 2 +- .../src/transformCommand.cpp | 22 +- apps/src/convolve.cpp | 4 +- apps/src/dinast_grabber_example.cpp | 17 +- apps/src/dominant_plane_segmentation.cpp | 10 +- apps/src/face_detection/face_trainer.cpp | 2 +- .../filesystem_face_detection.cpp | 14 +- .../face_detection/openni_face_detection.cpp | 8 +- .../face_detection/openni_frame_source.cpp | 9 +- apps/src/feature_matching.cpp | 98 +- apps/src/grabcut_2d.cpp | 33 +- .../manual_registration.cpp | 2 +- ...multiscale_feature_persistence_example.cpp | 3 +- apps/src/ni_agast.cpp | 36 +- apps/src/ni_brisk.cpp | 33 +- apps/src/ni_linemod.cpp | 153 +- apps/src/ni_susan.cpp | 29 +- apps/src/ni_trajkovic.cpp | 42 +- apps/src/nn_classification_example.cpp | 2 +- apps/src/openni_3d_concave_hull.cpp | 46 +- apps/src/openni_3d_convex_hull.cpp | 48 +- apps/src/openni_boundary_estimation.cpp | 55 +- apps/src/openni_change_viewer.cpp | 36 +- apps/src/openni_color_filter.cpp | 36 +- apps/src/openni_fast_mesh.cpp | 74 +- apps/src/openni_feature_persistence.cpp | 51 +- apps/src/openni_grab_frame.cpp | 34 +- apps/src/openni_grab_images.cpp | 111 +- apps/src/openni_ii_normal_estimation.cpp | 44 +- apps/src/openni_klt.cpp | 70 +- apps/src/openni_mls_smoothing.cpp | 37 +- apps/src/openni_mobile_server.cpp | 45 +- apps/src/openni_octree_compression.cpp | 60 +- apps/src/openni_organized_compression.cpp | 68 +- apps/src/openni_organized_edge_detection.cpp | 42 +- ...nni_organized_multi_plane_segmentation.cpp | 33 +- apps/src/openni_passthrough.cpp | 19 +- apps/src/openni_planar_convex_hull.cpp | 36 +- apps/src/openni_planar_segmentation.cpp | 36 +- apps/src/openni_shift_to_depth_conversion.cpp | 79 +- apps/src/openni_tracking.cpp | 140 +- apps/src/openni_uniform_sampling.cpp | 51 +- apps/src/openni_voxel_grid.cpp | 37 +- apps/src/organized_segmentation_demo.cpp | 149 +- apps/src/pcd_organized_edge_detection.cpp | 19 +- ...pcd_organized_multi_plane_segmentation.cpp | 6 +- apps/src/pcd_select_object_plane.cpp | 101 +- .../src/pcd_video_player/pcd_video_player.cpp | 41 +- apps/src/ppf_object_recognition.cpp | 23 +- apps/src/pyramid_surface_matching.cpp | 12 +- apps/src/render_views_tesselated_sphere.cpp | 99 +- ...ale_interest_region_extraction_example.cpp | 10 +- apps/src/stereo_ground_segmentation.cpp | 105 +- apps/src/test_search.cpp | 42 +- cmake/CMakeParseArguments.cmake | 138 - cmake/CudaComputeTargetFlags.cmake | 74 +- cmake/Modules/FindClangFormat.cmake | 72 + cmake/Modules/FindEigen.cmake | 4 +- cmake/Modules/FindFLANN.cmake | 199 +- cmake/Modules/FindFZAPI.cmake | 26 - cmake/Modules/FindG2O.cmake | 149 - cmake/Modules/FindGLEW.cmake | 115 - cmake/Modules/FindGTSAM.cmake | 87 - ...{FindGtest.cmake => FindGTestSource.cmake} | 9 +- cmake/Modules/FindOpenNI.cmake | 10 +- cmake/Modules/FindOpenNI2.cmake | 10 +- cmake/Modules/FindPcap.cmake | 30 +- cmake/Modules/FindQVTK.cmake | 30 - cmake/Modules/FindQhull.cmake | 16 +- cmake/Modules/FindRSSDK2.cmake | 20 + cmake/Modules/FindSphinx.cmake | 2 +- cmake/Modules/FindSuiteSparse.cmake | 122 - cmake/Modules/FinddavidSDK.cmake | 2 +- cmake/Modules/Findlibusb-1.0.cmake | 14 +- cmake/Modules/NSIS.template.in | 191 +- cmake/Modules/UseCompilerCache.cmake | 134 + cmake/clang-format.cmake | 12 + cmake/cpack_options.cmake.in | 24 +- cmake/dep_graph.cmake | 10 +- cmake/pcl_all_in_one_installer.cmake | 261 +- cmake/pcl_cpack.cmake | 48 +- cmake/pcl_find_boost.cmake | 40 +- cmake/pcl_find_cuda.cmake | 35 +- cmake/pcl_find_gl.cmake | 16 +- cmake/pcl_find_python.cmake | 54 - cmake/pcl_find_qt5.cmake | 78 - cmake/pcl_find_sse.cmake | 30 +- cmake/pcl_options.cmake | 20 +- cmake/pcl_pclconfig.cmake | 115 +- cmake/pcl_targets.cmake | 1154 ++- cmake/pcl_utils.cmake | 135 +- cmake/pcl_verbosity.cmake | 4 +- cmake/pkgconfig-headeronly.cmake.in | 2 +- cmake/uninstall_target.cmake.in | 4 +- cmake/version.rc.in | 44 + common/CMakeLists.txt | 344 +- common/include/pcl/ModelCoefficients.h | 19 +- common/include/pcl/PCLHeader.h | 21 +- common/include/pcl/PCLImage.h | 31 +- common/include/pcl/PCLPointCloud2.h | 109 +- common/include/pcl/PCLPointField.h | 24 +- common/include/pcl/PointIndices.h | 19 +- common/include/pcl/PolygonMesh.h | 90 +- common/include/pcl/TextureMesh.h | 25 +- common/include/pcl/Vertices.h | 21 +- common/include/pcl/cloud_iterator.h | 13 +- common/include/pcl/common/angles.h | 5 +- .../include/pcl/common/bivariate_polynomial.h | 10 +- common/include/pcl/common/boost.h | 9 +- common/include/pcl/common/centroid.h | 80 +- common/include/pcl/common/colors.h | 14 +- common/include/pcl/common/common.h | 5 +- common/include/pcl/common/common_headers.h | 5 +- common/include/pcl/common/concatenate.h | 47 +- common/include/pcl/common/copy_point.h | 6 +- common/include/pcl/common/distances.h | 27 +- common/include/pcl/common/eigen.h | 6 +- common/include/pcl/common/feature_histogram.h | 14 +- .../include/pcl/common/fft/_kiss_fft_guts.h | 2 +- common/include/pcl/common/fft/kiss_fft.h | 7 +- common/include/pcl/common/fft/kiss_fftr.h | 4 +- common/include/pcl/common/file_io.h | 5 +- common/include/pcl/common/gaussian.h | 22 +- common/include/pcl/common/generate.h | 9 +- common/include/pcl/common/geometry.h | 6 +- .../include/pcl/common/impl/accumulators.hpp | 115 +- common/include/pcl/common/impl/angles.hpp | 4 +- .../pcl/common/impl/bivariate_polynomial.hpp | 25 +- common/include/pcl/common/impl/centroid.hpp | 346 +- common/include/pcl/common/impl/common.hpp | 90 +- common/include/pcl/common/impl/copy_point.hpp | 42 +- common/include/pcl/common/impl/eigen.hpp | 278 +- common/include/pcl/common/impl/file_io.hpp | 14 +- common/include/pcl/common/impl/gaussian.hpp | 8 +- common/include/pcl/common/impl/generate.hpp | 18 +- common/include/pcl/common/impl/intensity.hpp | 36 +- .../include/pcl/common/impl/intersections.hpp | 18 +- common/include/pcl/common/impl/io.hpp | 155 +- common/include/pcl/common/impl/norms.hpp | 14 +- common/include/pcl/common/impl/pca.hpp | 26 +- .../common/impl/piecewise_linear_function.hpp | 4 +- .../common/impl/polynomial_calculations.hpp | 249 +- .../pcl/common/impl/projection_matrix.hpp | 4 +- common/include/pcl/common/impl/random.hpp | 61 +- common/include/pcl/common/impl/spring.hpp | 85 +- common/include/pcl/common/impl/transforms.hpp | 54 +- .../pcl/common/impl/vector_average.hpp | 33 +- common/include/pcl/common/intensity.h | 5 +- common/include/pcl/common/intersections.h | 5 +- common/include/pcl/common/io.h | 147 +- common/include/pcl/common/norms.h | 5 +- common/include/pcl/common/pca.h | 47 +- .../pcl/common/piecewise_linear_function.h | 5 +- common/include/pcl/common/point_operators.h | 5 +- common/include/pcl/common/point_tests.h | 102 +- .../pcl/common/polynomial_calculations.h | 27 +- .../include/pcl/common/poses_from_matches.h | 28 +- common/include/pcl/common/projection_matrix.h | 5 +- common/include/pcl/common/random.h | 76 +- common/include/pcl/common/spring.h | 21 +- common/include/pcl/common/synchronizer.h | 46 +- common/include/pcl/common/time.h | 53 +- common/include/pcl/common/time_trigger.h | 22 +- .../transformation_from_correspondences.h | 24 +- common/include/pcl/common/transforms.h | 6 +- common/include/pcl/common/utils.h | 7 +- common/include/pcl/common/vector_average.h | 43 +- common/include/pcl/console/parse.h | 7 +- common/include/pcl/console/print.h | 21 +- common/include/pcl/console/time.h | 30 +- common/include/pcl/conversions.h | 68 +- common/include/pcl/correspondence.h | 48 +- common/include/pcl/exceptions.h | 56 +- common/include/pcl/for_each_type.h | 22 +- common/include/pcl/impl/cloud_iterator.hpp | 62 +- common/include/pcl/impl/pcl_base.hpp | 27 +- common/include/pcl/impl/point_types.hpp | 198 +- .../include/pcl/make_shared.h | 58 +- common/include/pcl/pcl_base.h | 41 +- common/include/pcl/pcl_exports.h | 5 +- common/include/pcl/pcl_macros.h | 284 +- common/include/pcl/pcl_tests.h | 90 +- common/include/pcl/point_cloud.h | 234 +- common/include/pcl/point_representation.h | 103 +- common/include/pcl/point_traits.h | 124 +- common/include/pcl/point_types.h | 122 +- common/include/pcl/point_types_conversion.h | 82 +- .../pcl/range_image/bearing_angle_image.h | 9 +- .../pcl/range_image/impl/range_image.hpp | 149 +- .../range_image/impl/range_image_planar.hpp | 2 +- .../impl/range_image_spherical.hpp | 4 +- common/include/pcl/range_image/range_image.h | 31 +- .../pcl/range_image/range_image_planar.h | 37 +- .../pcl/range_image/range_image_spherical.h | 11 +- common/include/pcl/register_point_struct.h | 83 +- common/include/pcl/sse.h | 5 +- common/src/PCLPointCloud2.cpp | 178 + common/src/bearing_angle_image.cpp | 17 +- common/src/colors.cpp | 17 +- common/src/common.cpp | 23 +- common/src/correspondence.cpp | 12 +- common/src/feature_histogram.cpp | 16 +- common/src/fft/kiss_fft.c | 14 +- common/src/gaussian.cpp | 28 +- common/src/io.cpp | 76 +- common/src/parse.cpp | 46 +- common/src/pcl_base.cpp | 77 +- common/src/point_types.cpp | 12 +- common/src/poses_from_matches.cpp | 24 +- common/src/print.cpp | 43 +- common/src/projection_matrix.cpp | 8 +- common/src/range_image.cpp | 97 +- common/src/range_image_planar.cpp | 26 +- common/src/time_trigger.cpp | 49 +- cuda/CMakeLists.txt | 35 +- cuda/apps/CMakeLists.txt | 37 +- cuda/apps/src/kinect_cloud.cpp | 8 +- cuda/apps/src/kinect_debayering.cpp | 16 +- cuda/apps/src/kinect_dediscretize.cpp | 14 +- cuda/apps/src/kinect_mapping.cpp | 132 +- cuda/apps/src/kinect_normals_cuda.cpp | 60 +- cuda/apps/src/kinect_planes_cuda.cpp | 107 +- cuda/apps/src/kinect_ransac.cpp | 26 +- cuda/apps/src/kinect_segmentation_cuda.cpp | 83 +- .../src/kinect_segmentation_planes_cuda.cpp | 56 +- cuda/apps/src/kinect_tool_standalone.cpp | 15 +- cuda/apps/src/kinect_viewer_cuda.cpp | 17 +- cuda/common/CMakeLists.txt | 4 +- cuda/common/include/pcl/cuda/common/eigen.h | 17 +- .../include/pcl/cuda/common/point_type_rgb.h | 5 +- cuda/common/include/pcl/cuda/pcl_cuda_base.h | 12 +- cuda/common/include/pcl/cuda/point_cloud.h | 60 +- cuda/common/include/pcl/cuda/point_types.h | 6 +- cuda/common/include/pcl/cuda/thrust.h | 7 +- cuda/common/include/pcl/cuda/time_cpu.h | 7 +- cuda/common/include/pcl/cuda/time_gpu.h | 7 +- cuda/features/CMakeLists.txt | 36 +- .../include/pcl/cuda/features/normal_3d.h | 19 +- .../pcl/cuda/features/normal_3d_kernels.h | 29 +- cuda/features/src/normal_3d.cu | 62 +- .../filters/include/pcl/cuda/filters/filter.h | 11 +- .../include/pcl/cuda/filters/passthrough.h | 11 +- .../include/pcl/cuda/filters/voxel_grid.h | 11 +- cuda/io/CMakeLists.txt | 63 +- cuda/io/include/pcl/cuda/io/cloud_to_pcl.h | 5 +- cuda/io/include/pcl/cuda/io/debayering.h | 25 +- .../include/pcl/cuda/io/disparity_to_cloud.h | 21 +- cuda/io/include/pcl/cuda/io/extract_indices.h | 12 +- cuda/io/include/pcl/cuda/io/host_device.h | 5 +- .../io/include/pcl/cuda/io/kinect_smoothing.h | 14 +- cuda/io/include/pcl/cuda/io/predicate.h | 7 +- cuda/io/src/cloud_from_pcl.cu | 2 +- cuda/io/src/cloud_to_pcl.cpp | 12 +- cuda/io/src/debayering.cu | 12 +- cuda/io/src/disparity_to_cloud.cu | 30 +- cuda/io/src/extract_indices.cu | 18 +- cuda/io/src/kinect_smoothing.cu | 24 +- cuda/nn/organized_neighbor_search.h | 12 +- cuda/nn/organized_neighbor_search.hpp | 55 +- cuda/sample_consensus/CMakeLists.txt | 61 +- .../include/pcl/cuda/sample_consensus/msac.h | 14 +- .../pcl/cuda/sample_consensus/multi_ransac.h | 18 +- .../pcl/cuda/sample_consensus/ransac.h | 14 +- .../include/pcl/cuda/sample_consensus/sac.h | 27 +- .../pcl/cuda/sample_consensus/sac_model.h | 49 +- .../sample_consensus/sac_model_1point_plane.h | 42 +- .../cuda/sample_consensus/sac_model_plane.h | 38 +- cuda/sample_consensus/src/msac.cpp | 25 +- cuda/sample_consensus/src/multi_ransac.cu | 14 +- cuda/sample_consensus/src/ransac.cu | 4 +- .../src/sac_model_1point_plane.cu | 22 +- cuda/sample_consensus/src/sac_model_plane.cu | 4 +- cuda/segmentation/CMakeLists.txt | 34 +- .../cuda/segmentation/connected_components.h | 2 +- .../pcl/cuda/segmentation/mssegmentation.h | 12 +- cuda/segmentation/src/connected_components.cu | 6 +- cuda/segmentation/src/mssegmentation.cpp | 6 +- doc/CMakeLists.txt | 4 +- doc/advanced/CMakeLists.txt | 28 +- doc/advanced/content/pcl2.rst | 10 +- doc/advanced/content/pcl_style_guide.rst | 18 +- doc/advanced/content/vertical_sse.rst | 28 +- doc/doxygen/CMakeLists.txt | 104 +- doc/doxygen/doxyfile.in | 64 +- doc/tutorials/CMakeLists.txt | 28 +- doc/tutorials/content/adding_custom_ptype.rst | 95 +- doc/tutorials/content/building_pcl.rst | 8 +- .../compiling_pcl_dependencies_windows.rst | 5 +- .../content/compiling_pcl_macosx.rst | 2 +- doc/tutorials/content/compiling_pcl_posix.rst | 2 +- .../content/compiling_pcl_windows.rst | 9 +- doc/tutorials/content/conditional_removal.rst | 8 +- doc/tutorials/content/dinast_grabber.rst | 16 +- doc/tutorials/content/don_segmentation.rst | 2 +- doc/tutorials/content/gasd_estimation.rst | 4 +- doc/tutorials/content/gpu_people.rst | 10 +- .../ground_based_rgbd_people_detection.rst | 22 +- doc/tutorials/content/hdl_grabber.rst | 16 +- doc/tutorials/content/how_features_work.rst | 14 +- .../pcl_solution_with_projects_folder.png | Bin 113425 -> 95389 bytes .../pcl_solution_without_projects_folder.png | Bin 26433 -> 0 bytes doc/tutorials/content/mobile_streaming.rst | 12 +- doc/tutorials/content/moment_of_inertia.rst | 33 +- .../content/narf_feature_extraction.rst | 2 +- .../normal_distributions_transform.rst | 22 +- doc/tutorials/content/openni_grabber.rst | 25 +- .../pairwise_incremental_registration.rst | 2 +- doc/tutorials/content/pcl_visualizer.rst | 18 +- doc/tutorials/content/qt_colorize_cloud.rst | 4 +- doc/tutorials/content/qt_visualizer.rst | 12 +- .../content/random_sample_consensus.rst | 6 +- .../region_growing_rgb_segmentation.rst | 16 +- doc/tutorials/content/sources/CMakeLists.txt | 118 +- .../bspline_fitting/bspline_fitting.cpp | 2 +- .../concatenate_clouds/concatenate_clouds.cpp | 16 +- .../concatenate_fields/concatenate_fields.cpp | 10 +- .../concatenate_points/concatenate_points.cpp | 10 +- .../conditional_euclidean_clustering.cpp | 12 +- .../conditional_removal.cpp | 11 +- .../correspondence_grouping.cpp | 14 +- .../davidsdk/davidsdk_images_viewer.cpp | 7 +- .../don_segmentation/don_segmentation.cpp | 21 +- .../ensenso_cloud_images_viewer.cpp | 22 +- .../CMakeLists.txt | 2 +- .../global_hypothesis_verification.cpp | 34 +- .../sources/gpu/people_detect/CMakeLists.txt | 4 +- .../gpu/people_detect/src/people_detect.cpp | 48 +- .../main_ground_based_people_detection.cpp | 38 +- .../iccv2011/include/feature_estimation.h | 5 +- .../sources/iccv2011/include/filters.h | 5 +- .../sources/iccv2011/include/load_clouds.h | 10 +- .../iccv2011/include/object_recognition.h | 9 +- .../sources/iccv2011/include/openni_capture.h | 11 +- .../sources/iccv2011/include/registration.h | 5 +- .../sources/iccv2011/include/segmentation.h | 5 +- .../sources/iccv2011/include/surface.h | 5 +- .../sources/iccv2011/include/typedefs.h | 5 +- .../iccv2011/src/build_all_object_models.cpp | 27 +- .../iccv2011/src/correspondence_viewer.cpp | 4 +- .../sources/iccv2011/src/openni_capture.cpp | 10 +- .../sources/iccv2011/src/test_filters.cpp | 6 +- .../iccv2011/src/test_segmentation.cpp | 4 +- .../content/sources/iccv2011/src/tutorial.cpp | 66 +- .../implicit_shape_model.cpp | 9 +- .../interactive_icp/interactive_icp.cpp | 4 +- .../iros2011/include/feature_estimation.h | 5 +- .../sources/iros2011/include/filters.h | 5 +- .../sources/iros2011/include/load_clouds.h | 12 +- .../iros2011/include/object_recognition.h | 6 +- .../sources/iros2011/include/openni_capture.h | 9 +- .../sources/iros2011/include/registration.h | 6 +- .../sources/iros2011/include/segmentation.h | 5 +- .../include/solution/feature_estimation.h | 5 +- .../iros2011/include/solution/filters.h | 5 +- .../include/solution/object_recognition.h | 10 +- .../include/solution/openni_capture.h | 9 +- .../iros2011/include/solution/registration.h | 5 +- .../iros2011/include/solution/segmentation.h | 5 +- .../iros2011/include/solution/surface.h | 5 +- .../iros2011/include/solution/typedefs.h | 5 +- .../sources/iros2011/include/surface.h | 5 +- .../sources/iros2011/include/typedefs.h | 5 +- .../iros2011/src/build_all_object_models.cpp | 27 +- .../iros2011/src/correspondence_viewer.cpp | 4 +- .../sources/iros2011/src/openni_capture.cpp | 8 +- .../sources/iros2011/src/test_filters.cpp | 6 +- .../iros2011/src/test_segmentation.cpp | 4 +- .../iterative_closest_point.cpp | 8 +- .../sources/kdtree_search/kdtree_search.cpp | 6 +- .../matrix_transform/matrix_transform.cpp | 4 +- .../model_outlier_removal.cpp | 8 +- .../moment_of_inertia/moment_of_inertia.cpp | 53 +- .../narf_descriptor_visualization.cpp | 9 +- .../narf_feature_extraction.cpp | 23 +- .../narf_keypoint_extraction.cpp | 19 +- .../CMakeLists.txt | 4 +- .../normal_distributions_transform.cpp | 9 +- .../octree_change_detection.cpp | 6 +- .../sources/octree_search/octree_search.cpp | 8 +- .../sources/openni_grabber/openni_grabber.cpp | 10 +- .../CMakeLists.txt | 2 +- .../openni_narf_keypoint_extraction.cpp | 42 +- .../CMakeLists.txt | 2 +- .../openni_range_image_visualization.cpp | 30 +- .../pairwise_incremental_registration.cpp | 8 +- .../sources/passthrough/passthrough.cpp | 6 +- .../content/sources/pcd_read/pcd_read.cpp | 2 +- .../content/sources/pcd_write/pcd_write.cpp | 4 +- .../sources/pcl_painter2D/CMakeLists.txt | 2 +- .../sources/pcl_plotter/CMakeLists.txt | 2 +- .../sources/pcl_plotter/pcl_plotter_demo.cpp | 12 +- .../pcl_visualizer/pcl_visualizer_demo.cpp | 45 +- .../planar_segmentation.cpp | 6 +- .../point_cloud_compression.cpp | 4 +- .../project_inliers/project_inliers.cpp | 6 +- .../sources/qt_colorize_cloud/CMakeLists.txt | 4 +- .../sources/qt_colorize_cloud/pclviewer.cpp | 8 +- .../sources/qt_colorize_cloud/pclviewer.h | 7 +- .../sources/qt_visualizer/CMakeLists.txt | 4 +- .../sources/qt_visualizer/pclviewer.cpp | 6 +- .../content/sources/qt_visualizer/pclviewer.h | 7 +- .../radius_outlier_removal.cpp | 6 +- .../random_sample_consensus.cpp | 17 +- .../range_image_border_extraction.cpp | 13 +- .../range_image_creation.cpp | 2 +- .../range_image_visualization.cpp | 4 +- .../region_growing_rgb_segmentation.cpp | 8 +- .../region_growing_segmentation.cpp | 4 +- .../sources/registration_api/example1.cpp | 6 +- .../sources/registration_api/example2.cpp | 16 +- .../remove_outliers/remove_outliers.cpp | 6 +- .../content/sources/resampling/resampling.cpp | 2 +- .../sources/rops_feature/rops_feature.cpp | 2 +- .../stick_segmentation/stick_segmentation.cpp | 11 +- .../supervoxel_clustering/CMakeLists.txt | 2 +- .../supervoxel_clustering.cpp | 23 +- .../template_alignment/template_alignment.cpp | 9 +- .../sources/tracking/tracking_sample.cpp | 43 +- .../sources/vfh_recognition/CMakeLists.txt | 27 +- .../sources/vfh_recognition/FindFLANN.cmake | 63 - .../sources/vfh_recognition/build_tree.cpp | 10 +- .../vfh_recognition/nearest_neighbors.cpp | 8 +- .../content/supervoxel_clustering.rst | 4 +- doc/tutorials/content/template_alignment.rst | 6 +- doc/tutorials/content/tracking.rst | 12 +- .../content/using_pcl_pcl_config.rst | 4 +- doc/tutorials/content/walkthrough.rst | 4 +- doc/tutorials/content/writing_new_classes.rst | 34 +- examples/CMakeLists.txt | 59 +- examples/common/example_copy_point_cloud.cpp | 10 +- .../common/example_organized_point_cloud.cpp | 4 +- examples/common/example_scope_time.cpp | 2 +- .../example_difference_of_normals.cpp | 51 +- .../features/example_normal_estimation.cpp | 1 - examples/features/example_rift_estimation.cpp | 1 - examples/features/example_shape_contexts.cpp | 2 +- examples/features/example_spin_images.cpp | 2 +- examples/filters/example_extract_indices.cpp | 4 +- .../example_remove_nan_from_point_cloud.cpp | 2 +- examples/geometry/CMakeLists.txt | 11 +- examples/geometry/example_half_edge_mesh.cpp | 32 +- examples/keypoints/CMakeLists.txt | 43 +- ...xample_sift_normal_keypoint_estimation.cpp | 2 +- examples/outofcore/CMakeLists.txt | 30 +- examples/outofcore/example_outofcore.cpp | 6 +- .../outofcore/example_outofcore_with_lod.cpp | 4 +- examples/segmentation/CMakeLists.txt | 35 +- .../segmentation/example_cpc_segmentation.cpp | 47 +- .../example_extract_clusters_normals.cpp | 9 +- .../example_lccp_segmentation.cpp | 45 +- examples/segmentation/example_supervoxels.cpp | 109 +- examples/stereo/CMakeLists.txt | 31 +- examples/stereo/example_stereo_baseline.cpp | 7 +- examples/surface/CMakeLists.txt | 94 +- .../example_nurbs_fitting_closed_curve.cpp | 7 +- .../example_nurbs_fitting_closed_curve3d.cpp | 7 +- .../surface/example_nurbs_fitting_curve2d.cpp | 7 +- .../surface/example_nurbs_fitting_surface.cpp | 9 +- .../surface/example_nurbs_viewer_surface.cpp | 6 +- .../surface/test_nurbs_fitting_surface.cpp | 4 +- features/CMakeLists.txt | 325 +- features/include/pcl/features/3dsc.h | 67 +- features/include/pcl/features/board.h | 26 +- features/include/pcl/features/boost.h | 11 +- features/include/pcl/features/boundary.h | 13 +- features/include/pcl/features/brisk_2d.h | 21 +- features/include/pcl/features/cppf.h | 13 +- features/include/pcl/features/crh.h | 13 +- features/include/pcl/features/cvfh.h | 33 +- features/include/pcl/features/don.h | 28 +- features/include/pcl/features/eigen.h | 5 +- features/include/pcl/features/esf.h | 18 +- features/include/pcl/features/feature.h | 88 +- features/include/pcl/features/flare.h | 25 +- features/include/pcl/features/fpfh.h | 14 +- features/include/pcl/features/fpfh_omp.h | 13 +- features/include/pcl/features/from_meshes.h | 51 +- features/include/pcl/features/gasd.h | 61 +- features/include/pcl/features/gfpfh.h | 25 +- features/include/pcl/features/grsd.h | 14 +- features/include/pcl/features/impl/3dsc.hpp | 56 +- features/include/pcl/features/impl/board.hpp | 30 +- .../include/pcl/features/impl/boundary.hpp | 29 +- .../include/pcl/features/impl/brisk_2d.hpp | 64 +- features/include/pcl/features/impl/cppf.hpp | 27 +- features/include/pcl/features/impl/crh.hpp | 39 +- features/include/pcl/features/impl/cvfh.hpp | 75 +- features/include/pcl/features/impl/don.hpp | 8 +- features/include/pcl/features/impl/esf.hpp | 131 +- .../include/pcl/features/impl/feature.hpp | 25 +- features/include/pcl/features/impl/flare.hpp | 14 +- features/include/pcl/features/impl/fpfh.hpp | 70 +- .../include/pcl/features/impl/fpfh_omp.hpp | 16 +- features/include/pcl/features/impl/gasd.hpp | 51 +- features/include/pcl/features/impl/gfpfh.hpp | 75 +- features/include/pcl/features/impl/grsd.hpp | 21 +- .../pcl/features/impl/integral_image2D.hpp | 8 +- .../features/impl/integral_image_normal.hpp | 135 +- .../pcl/features/impl/intensity_gradient.hpp | 30 +- .../pcl/features/impl/intensity_spin.hpp | 18 +- .../impl/linear_least_squares_normal.hpp | 18 +- .../pcl/features/impl/moment_invariants.hpp | 14 +- .../impl/moment_of_inertia_estimation.hpp | 27 +- .../impl/multiscale_feature_persistence.hpp | 83 +- features/include/pcl/features/impl/narf.hpp | 4 +- .../include/pcl/features/impl/normal_3d.hpp | 4 +- .../pcl/features/impl/normal_3d_omp.hpp | 8 +- .../features/impl/normal_based_signature.hpp | 36 +- .../impl/organized_edge_detection.hpp | 47 +- .../include/pcl/features/impl/our_cvfh.hpp | 138 +- features/include/pcl/features/impl/pfh.hpp | 28 +- features/include/pcl/features/impl/pfhrgb.hpp | 58 +- features/include/pcl/features/impl/ppf.hpp | 14 +- features/include/pcl/features/impl/ppfrgb.hpp | 19 +- .../features/impl/principal_curvatures.hpp | 8 +- .../impl/range_image_border_extractor.hpp | 44 +- features/include/pcl/features/impl/rift.hpp | 24 +- .../pcl/features/impl/rops_estimation.hpp | 147 +- features/include/pcl/features/impl/rsd.hpp | 61 +- features/include/pcl/features/impl/shot.hpp | 106 +- .../include/pcl/features/impl/shot_lrf.hpp | 6 +- .../pcl/features/impl/shot_lrf_omp.hpp | 3 +- .../include/pcl/features/impl/shot_omp.hpp | 32 +- .../include/pcl/features/impl/spin_image.hpp | 25 +- ..._multiscale_interest_region_extraction.hpp | 42 +- features/include/pcl/features/impl/usc.hpp | 50 +- features/include/pcl/features/impl/vfh.hpp | 97 +- .../include/pcl/features/integral_image2D.h | 60 +- .../pcl/features/integral_image_normal.h | 41 +- .../include/pcl/features/intensity_gradient.h | 14 +- .../include/pcl/features/intensity_spin.h | 22 +- .../features/linear_least_squares_normal.h | 22 +- .../include/pcl/features/moment_invariants.h | 15 +- .../features/moment_of_inertia_estimation.h | 36 +- .../features/multiscale_feature_persistence.h | 23 +- features/include/pcl/features/narf.h | 20 +- .../include/pcl/features/narf_descriptor.h | 27 +- features/include/pcl/features/normal_3d.h | 31 +- features/include/pcl/features/normal_3d_omp.h | 13 +- .../pcl/features/normal_based_signature.h | 31 +- .../pcl/features/organized_edge_detection.h | 77 +- features/include/pcl/features/our_cvfh.h | 28 +- features/include/pcl/features/pfh.h | 21 +- features/include/pcl/features/pfh_tools.h | 6 +- features/include/pcl/features/pfhrgb.h | 15 +- features/include/pcl/features/ppf.h | 13 +- features/include/pcl/features/ppfrgb.h | 15 +- .../pcl/features/principal_curvatures.h | 16 +- .../features/range_image_border_extractor.h | 47 +- features/include/pcl/features/rift.h | 21 +- .../include/pcl/features/rops_estimation.h | 19 +- features/include/pcl/features/rsd.h | 56 +- features/include/pcl/features/shot.h | 47 +- features/include/pcl/features/shot_lrf.h | 20 +- features/include/pcl/features/shot_lrf_omp.h | 20 +- features/include/pcl/features/shot_omp.h | 29 +- features/include/pcl/features/spin_image.h | 34 +- ...al_multiscale_interest_region_extraction.h | 16 +- features/include/pcl/features/usc.h | 39 +- features/include/pcl/features/vfh.h | 18 +- features/src/narf.cpp | 95 +- features/src/pfh.cpp | 6 +- features/src/range_image_border_extractor.cpp | 173 +- filters/CMakeLists.txt | 237 +- .../pcl/filters/approximate_voxel_grid.h | 41 +- filters/include/pcl/filters/bilateral.h | 17 +- filters/include/pcl/filters/boost.h | 8 +- filters/include/pcl/filters/box_clipper3D.h | 39 +- filters/include/pcl/filters/clipper3D.h | 13 +- .../include/pcl/filters/conditional_removal.h | 130 +- filters/include/pcl/filters/convolution.h | 17 +- filters/include/pcl/filters/convolution_3d.h | 33 +- .../include/pcl/filters/covariance_sampling.h | 26 +- filters/include/pcl/filters/crop_box.h | 31 +- filters/include/pcl/filters/crop_hull.h | 20 +- filters/include/pcl/filters/extract_indices.h | 32 +- filters/include/pcl/filters/fast_bilateral.h | 45 +- .../include/pcl/filters/fast_bilateral_omp.h | 20 +- filters/include/pcl/filters/filter.h | 33 +- filters/include/pcl/filters/filter_indices.h | 26 +- filters/include/pcl/filters/frustum_culling.h | 23 +- filters/include/pcl/filters/grid_minimum.h | 14 +- .../filters/impl/approximate_voxel_grid.hpp | 22 +- .../include/pcl/filters/impl/bilateral.hpp | 6 +- .../pcl/filters/impl/box_clipper3D.hpp | 12 +- .../pcl/filters/impl/conditional_removal.hpp | 178 +- .../include/pcl/filters/impl/convolution.hpp | 45 +- .../pcl/filters/impl/convolution_3d.hpp | 12 +- .../pcl/filters/impl/covariance_sampling.hpp | 38 +- filters/include/pcl/filters/impl/crop_box.hpp | 14 +- .../include/pcl/filters/impl/crop_hull.hpp | 40 +- .../pcl/filters/impl/extract_indices.hpp | 22 +- .../pcl/filters/impl/fast_bilateral.hpp | 77 +- .../pcl/filters/impl/fast_bilateral_omp.hpp | 57 +- filters/include/pcl/filters/impl/filter.hpp | 26 +- .../pcl/filters/impl/filter_indices.hpp | 10 +- .../pcl/filters/impl/frustum_culling.hpp | 70 +- .../include/pcl/filters/impl/grid_minimum.hpp | 34 +- .../pcl/filters/impl/local_maximum.hpp | 4 +- .../pcl/filters/impl/median_filter.hpp | 6 +- .../filters/impl/model_outlier_removal.hpp | 4 +- .../pcl/filters/impl/morphological_filter.hpp | 16 +- .../include/pcl/filters/impl/normal_space.hpp | 33 +- .../include/pcl/filters/impl/passthrough.hpp | 42 +- .../pcl/filters/impl/plane_clipper3D.hpp | 12 +- .../pcl/filters/impl/project_inliers.hpp | 2 +- filters/include/pcl/filters/impl/pyramid.hpp | 46 +- .../filters/impl/radius_outlier_removal.hpp | 6 +- .../pcl/filters/impl/random_sample.hpp | 41 +- .../filters/impl/sampling_surface_normal.hpp | 26 +- .../include/pcl/filters/impl/shadowpoints.hpp | 12 +- .../impl/statistical_outlier_removal.hpp | 18 +- .../pcl/filters/impl/uniform_sampling.hpp | 52 +- .../include/pcl/filters/impl/voxel_grid.hpp | 104 +- .../filters/impl/voxel_grid_covariance.hpp | 72 +- .../impl/voxel_grid_occlusion_estimation.hpp | 12 +- filters/include/pcl/filters/local_maximum.h | 14 +- filters/include/pcl/filters/median_filter.h | 9 +- .../pcl/filters/model_outlier_removal.h | 31 +- .../pcl/filters/morphological_filter.h | 6 +- .../include/pcl/filters/normal_refinement.h | 19 +- filters/include/pcl/filters/normal_space.h | 34 +- filters/include/pcl/filters/passthrough.h | 95 +- filters/include/pcl/filters/plane_clipper3D.h | 10 +- filters/include/pcl/filters/project_inliers.h | 37 +- filters/include/pcl/filters/pyramid.h | 16 +- .../pcl/filters/radius_outlier_removal.h | 51 +- filters/include/pcl/filters/random_sample.h | 41 +- .../pcl/filters/sampling_surface_normal.h | 29 +- filters/include/pcl/filters/shadowpoints.h | 25 +- .../pcl/filters/statistical_outlier_removal.h | 42 +- .../include/pcl/filters/uniform_sampling.h | 23 +- filters/include/pcl/filters/voxel_grid.h | 79 +- .../pcl/filters/voxel_grid_covariance.h | 68 +- .../include/pcl/filters/voxel_grid_label.h | 11 +- .../filters/voxel_grid_occlusion_estimation.h | 23 +- filters/src/crop_box.cpp | 135 +- filters/src/extract_indices.cpp | 83 +- filters/src/normal_refinement.cpp | 2 +- filters/src/passthrough.cpp | 130 +- filters/src/project_inliers.cpp | 8 +- filters/src/radius_outlier_removal.cpp | 155 +- filters/src/random_sample.cpp | 145 +- filters/src/statistical_outlier_removal.cpp | 22 +- filters/src/voxel_grid.cpp | 110 +- filters/src/voxel_grid_label.cpp | 86 +- geometry/CMakeLists.txt | 71 +- geometry/include/pcl/geometry/boost.h | 8 +- geometry/include/pcl/geometry/eigen.h | 5 +- geometry/include/pcl/geometry/get_boundary.h | 15 +- .../pcl/geometry/impl/polygon_operations.hpp | 26 +- geometry/include/pcl/geometry/line_iterator.h | 20 +- geometry/include/pcl/geometry/mesh_base.h | 295 +- .../include/pcl/geometry/mesh_circulators.h | 121 +- .../include/pcl/geometry/mesh_conversion.h | 32 +- geometry/include/pcl/geometry/mesh_elements.h | 15 +- geometry/include/pcl/geometry/mesh_indices.h | 37 +- geometry/include/pcl/geometry/mesh_io.h | 27 +- geometry/include/pcl/geometry/mesh_traits.h | 29 +- .../pcl/geometry/organized_index_iterator.h | 5 +- .../include/pcl/geometry/planar_polygon.h | 16 +- geometry/include/pcl/geometry/polygon_mesh.h | 77 +- .../include/pcl/geometry/polygon_operations.h | 4 +- geometry/include/pcl/geometry/quad_mesh.h | 80 +- geometry/include/pcl/geometry/triangle_mesh.h | 98 +- gpu/CMakeLists.txt | 37 +- gpu/containers/CMakeLists.txt | 36 +- .../include/pcl/gpu/containers/device_array.h | 27 +- .../pcl/gpu/containers/device_memory.h | 27 +- .../pcl/gpu/containers/impl/device_array.hpp | 18 +- .../pcl/gpu/containers/initialization.h | 5 +- .../pcl/gpu/containers/kernel_containers.h | 26 +- gpu/containers/src/device_memory.cpp | 68 +- gpu/containers/src/error.cpp | 2 +- gpu/containers/src/initialization.cpp | 16 +- gpu/examples/octree/src/octree_search.cpp | 8 +- gpu/features/CMakeLists.txt | 54 +- .../include/pcl/gpu/features/device/eigen.hpp | 27 +- .../pcl/gpu/features/device/pair_features.hpp | 10 +- .../include/pcl/gpu/features/features.hpp | 20 +- gpu/features/src/features.cpp | 2 +- gpu/features/src/fpfh.cu | 12 +- gpu/features/src/internal.hpp | 24 +- gpu/features/src/normal_3d.cu | 11 +- gpu/features/src/pfh.cu | 14 +- gpu/features/src/spinimages.cu | 27 +- gpu/features/src/uniq_inds.cu | 2 +- gpu/features/src/vfh.cu | 10 +- gpu/features/test/CMakeLists.txt | 53 +- gpu/features/test/data_source.hpp | 22 +- gpu/features/test/test_fpfh.cpp | 74 +- gpu/features/test/test_normals.cpp | 86 +- gpu/features/test/test_pfh.cpp | 84 +- gpu/features/test/test_ppf.cpp | 38 +- .../test/test_principal_curvatures.cpp | 14 +- gpu/features/test/test_spinimages.cpp | 58 +- gpu/features/test/test_vfh.cpp | 42 +- gpu/kinfu/CMakeLists.txt | 80 +- .../include/pcl/gpu/kinfu/color_volume.h | 12 +- gpu/kinfu/include/pcl/gpu/kinfu/kinfu.h | 29 +- .../include/pcl/gpu/kinfu/marching_cubes.h | 12 +- gpu/kinfu/include/pcl/gpu/kinfu/pixel_rgb.h | 5 +- gpu/kinfu/include/pcl/gpu/kinfu/raycaster.h | 20 +- gpu/kinfu/include/pcl/gpu/kinfu/tsdf_volume.h | 14 +- gpu/kinfu/src/cuda/bilateral_pyrdown.cu | 10 +- gpu/kinfu/src/cuda/device.hpp | 2 - gpu/kinfu/src/cuda/estimate_combined.cu | 2 +- gpu/kinfu/src/cuda/estimate_tranform.cu | 4 +- gpu/kinfu/src/cuda/extract.cu | 36 +- gpu/kinfu/src/cuda/image_generator.cu | 2 +- gpu/kinfu/src/cuda/maps.cu | 12 +- gpu/kinfu/src/cuda/marching_cubes.cu | 31 +- gpu/kinfu/src/cuda/normals_eigen.cu | 4 +- gpu/kinfu/src/cuda/ray_caster.cu | 10 +- gpu/kinfu/src/cuda/tsdf_volume.cu | 10 +- gpu/kinfu/src/cuda/utils.hpp | 63 +- gpu/kinfu/src/internal.h | 23 +- gpu/kinfu/src/kinfu.cpp | 15 +- gpu/kinfu/src/raycaster.cpp | 2 +- gpu/kinfu/src/tsdf_volume.cpp | 10 +- gpu/kinfu/tools/CMakeLists.txt | 93 +- gpu/kinfu/tools/camera_pose.h | 7 +- gpu/kinfu/tools/capture.cpp | 12 +- gpu/kinfu/tools/evaluation.cpp | 38 +- gpu/kinfu/tools/evaluation.h | 13 +- gpu/kinfu/tools/kinfu_app.cpp | 294 +- gpu/kinfu/tools/kinfu_app_sim.cpp | 740 +- gpu/kinfu/tools/openni_capture.h | 6 +- gpu/kinfu/tools/record_tsdfvolume.cpp | 42 +- gpu/kinfu/tools/tsdf_volume.h | 27 +- gpu/kinfu/tools/tsdf_volume.hpp | 186 +- gpu/kinfu_large_scale/CMakeLists.txt | 97 +- .../pcl/gpu/kinfu_large_scale/color_volume.h | 43 +- .../gpu/kinfu_large_scale/cyclical_buffer.h | 6 +- .../pcl/gpu/kinfu_large_scale/device.h | 36 +- .../impl/standalone_marching_cubes.hpp | 19 +- .../kinfu_large_scale/impl/world_model.hpp | 12 +- .../include/pcl/gpu/kinfu_large_scale/kinfu.h | 27 +- .../gpu/kinfu_large_scale/marching_cubes.h | 12 +- .../pcl/gpu/kinfu_large_scale/pixel_rgb.h | 6 +- .../gpu/kinfu_large_scale/point_intensity.h | 12 +- .../pcl/gpu/kinfu_large_scale/raycaster.h | 18 +- .../kinfu_large_scale/screenshot_manager.h | 10 +- .../standalone_marching_cubes.h | 16 +- .../pcl/gpu/kinfu_large_scale/tsdf_buffer.h | 7 +- .../pcl/gpu/kinfu_large_scale/tsdf_volume.h | 100 +- .../pcl/gpu/kinfu_large_scale/world_model.h | 27 +- .../src/cuda/bilateral_pyrdown.cu | 4 +- gpu/kinfu_large_scale/src/cuda/device.hpp | 2 - .../src/cuda/estimate_combined.cu | 2 +- .../src/cuda/estimate_tranform.cu | 4 +- gpu/kinfu_large_scale/src/cuda/extract.cu | 44 +- .../src/cuda/image_generator.cu | 2 +- gpu/kinfu_large_scale/src/cuda/maps.cu | 12 +- .../src/cuda/marching_cubes.cu | 6 +- .../src/cuda/normals_eigen.cu | 4 +- gpu/kinfu_large_scale/src/cuda/push.cu | 2 +- gpu/kinfu_large_scale/src/cuda/ray_caster.cu | 10 +- gpu/kinfu_large_scale/src/cuda/tsdf_volume.cu | 10 +- gpu/kinfu_large_scale/src/cuda/utils.hpp | 63 +- gpu/kinfu_large_scale/src/cyclical_buffer.cpp | 11 +- gpu/kinfu_large_scale/src/estimate_combined.h | 5 +- gpu/kinfu_large_scale/src/internal.h | 9 +- gpu/kinfu_large_scale/src/kinfu.cpp | 52 +- gpu/kinfu_large_scale/src/raycaster.cpp | 2 +- .../src/screenshot_manager.cpp | 4 +- gpu/kinfu_large_scale/src/tsdf_volume.cpp | 14 +- gpu/kinfu_large_scale/tools/CMakeLists.txt | 95 +- gpu/kinfu_large_scale/tools/capture.cpp | 16 +- gpu/kinfu_large_scale/tools/color_handler.h | 22 +- gpu/kinfu_large_scale/tools/evaluation.cpp | 38 +- gpu/kinfu_large_scale/tools/evaluation.h | 13 +- gpu/kinfu_large_scale/tools/kinfuLS_app.cpp | 371 +- gpu/kinfu_large_scale/tools/kinfu_app_sim.cpp | 250 +- gpu/kinfu_large_scale/tools/openni_capture.h | 6 +- .../process_kinfu_large_scale_output.cpp | 4 +- .../tools/record_maps_rgb.cpp | 99 +- .../tools/record_tsdfvolume.cpp | 42 +- .../tools/standalone_texture_mapping.cpp | 59 +- gpu/octree/CMakeLists.txt | 44 +- .../include/pcl/gpu/octree/device_format.hpp | 6 +- gpu/octree/include/pcl/gpu/octree/octree.hpp | 15 +- gpu/octree/src/cuda/approx_nsearch.cu | 13 +- gpu/octree/src/cuda/bfrs.cu | 9 +- gpu/octree/src/cuda/knn_search.cu | 19 +- gpu/octree/src/cuda/octree_host.cu | 6 +- gpu/octree/src/cuda/octree_iterator.hpp | 2 +- gpu/octree/src/cuda/radius_search.cu | 20 +- gpu/octree/src/internal.hpp | 22 +- gpu/octree/src/octree.cpp | 8 +- gpu/octree/src/utils/emulation.hpp | 6 - gpu/octree/src/utils/morton.hpp | 8 +- gpu/octree/test/CMakeLists.txt | 19 +- gpu/octree/test/data_source.hpp | 16 +- gpu/octree/test/perfomance.cpp | 42 +- gpu/octree/test/test_approx_nearest.cpp | 22 +- gpu/octree/test/test_bfrs_gpu.cpp | 10 +- gpu/octree/test/test_host_radius_search.cpp | 14 +- gpu/octree/test/test_knn_search.cpp | 22 +- gpu/octree/test/test_radius_search.cpp | 34 +- gpu/people/CMakeLists.txt | 122 +- .../pcl/gpu/people/bodyparts_detector.h | 24 +- gpu/people/include/pcl/gpu/people/colormap.h | 4 +- .../include/pcl/gpu/people/face_detector.h | 15 +- .../include/pcl/gpu/people/label_blob2.h | 5 +- .../include/pcl/gpu/people/label_common.h | 19 +- .../include/pcl/gpu/people/label_segment.h | 11 +- .../include/pcl/gpu/people/label_tree.h | 70 +- .../pcl/gpu/people/organized_plane_detector.h | 20 +- .../include/pcl/gpu/people/people_detector.h | 27 +- .../include/pcl/gpu/people/person_attribs.h | 10 +- .../pcl/gpu/people/probability_processor.h | 23 +- gpu/people/include/pcl/gpu/people/tree.h | 36 +- .../include/pcl/gpu/people/tree_train.h | 18 +- gpu/people/src/bodyparts_detector.cpp | 52 +- gpu/people/src/colormap.cpp | 4 +- gpu/people/src/cuda/device.h | 5 +- gpu/people/src/cuda/elec.cu | 22 - gpu/people/src/cuda/multi_tree.cu | 21 +- gpu/people/src/cuda/nvidia/NCV.cu | 177 +- gpu/people/src/cuda/nvidia/NCV.hpp | 142 +- .../src/cuda/nvidia/NCVHaarObjectDetection.cu | 22 +- .../cuda/nvidia/NCVHaarObjectDetection.hpp | 35 +- .../src/cuda/nvidia/NCVPixelOperations.hpp | 102 +- gpu/people/src/cuda/nvidia/NCVPyramid.cu | 12 +- .../src/cuda/nvidia/NCVRuntimeTemplates.hpp | 8 +- gpu/people/src/cuda/nvidia/NPP_staging.cu | 70 +- gpu/people/src/cuda/prob.cu | 13 +- gpu/people/src/cuda/shs.cu | 14 +- gpu/people/src/cuda/smooth.cu | 2 +- gpu/people/src/cuda/utils.cu | 14 +- gpu/people/src/cuda_async_copy.h | 9 +- gpu/people/src/face_detector.cpp | 100 +- gpu/people/src/internal.h | 25 +- gpu/people/src/organized_plane_detector.cpp | 14 +- gpu/people/src/people_detector.cpp | 66 +- gpu/people/src/probability_processor.cpp | 8 +- gpu/people/src/trees.cpp | 20 +- gpu/people/tools/CMakeLists.txt | 30 +- gpu/people/tools/people_app.cpp | 104 +- gpu/people/tools/people_pcd_prob.cpp | 16 +- gpu/people/tools/people_tracking.cpp | 28 +- gpu/segmentation/CMakeLists.txt | 56 +- .../gpu/segmentation/gpu_extract_clusters.h | 39 +- .../gpu_extract_labeled_clusters.h | 26 +- .../gpu_seeded_hue_segmentation.h | 41 +- .../impl/gpu_extract_clusters.hpp | 20 +- .../impl/gpu_extract_labeled_clusters.hpp | 24 +- .../impl/gpu_seeded_hue_segmentation.hpp | 20 +- gpu/surface/CMakeLists.txt | 60 +- .../include/pcl/gpu/surface/convex_hull.h | 16 +- gpu/surface/src/convex_hull.cpp | 12 +- gpu/surface/src/cuda/convex_hull.cu | 57 +- gpu/surface/src/cuda/device.h | 7 +- gpu/surface/src/internal.h | 29 +- gpu/surface/test/CMakeLists.txt | 41 +- gpu/tracking/CMakeLists.txt | 51 +- .../pcl/gpu/tracking/particle_filter.h | 17 +- gpu/tracking/src/internal.h | 14 +- gpu/utils/CMakeLists.txt | 38 +- .../pcl/gpu/utils/device/algorithm.hpp | 2 +- .../include/pcl/gpu/utils/device/cache.hpp | 5 - .../pcl/gpu/utils/device/emulation.hpp | 6 - .../include/pcl/gpu/utils/device/limits.hpp | 228 - .../include/pcl/gpu/utils/device/warp.hpp | 8 - gpu/utils/src/repacks.cpp | 2 +- gpu/utils/src/repacks.cu | 2 +- io/CMakeLists.txt | 786 +- io/include/pcl/compression/color_coding.h | 61 +- .../pcl/compression/compression_profiles.h | 7 +- .../pcl/compression/entropy_range_coder.h | 29 +- .../compression/impl/entropy_range_coder.hpp | 222 +- .../impl/octree_pointcloud_compression.hpp | 41 +- .../impl/organized_pointcloud_compression.hpp | 134 +- io/include/pcl/compression/libpng_wrapper.h | 55 +- .../octree_pointcloud_compression.h | 64 +- .../organized_pointcloud_compression.h | 19 +- .../organized_pointcloud_conversion.h | 150 +- io/include/pcl/compression/point_coding.h | 34 +- io/include/pcl/io/ascii_io.h | 24 +- io/include/pcl/io/auto_io.h | 5 +- io/include/pcl/io/boost.h | 18 +- io/include/pcl/io/buffers.h | 66 +- io/include/pcl/io/davidsdk_grabber.h | 38 +- io/include/pcl/io/debayer.h | 8 +- .../depth_sense/depth_sense_device_manager.h | 24 +- .../io/depth_sense/depth_sense_grabber_impl.h | 29 +- io/include/pcl/io/depth_sense_grabber.h | 18 +- io/include/pcl/io/dinast_grabber.h | 36 +- io/include/pcl/io/eigen.h | 6 +- io/include/pcl/io/ensenso_grabber.h | 37 +- io/include/pcl/io/file_grabber.h | 19 +- io/include/pcl/io/file_io.h | 92 +- io/include/pcl/io/fotonic_grabber.h | 124 +- io/include/pcl/io/grabber.h | 70 +- io/include/pcl/io/hdl_grabber.h | 122 +- io/include/pcl/io/ifs_io.h | 5 +- io/include/pcl/io/image.h | 29 +- io/include/pcl/io/image_depth.h | 31 +- io/include/pcl/io/image_grabber.h | 73 +- io/include/pcl/io/image_ir.h | 18 +- io/include/pcl/io/image_metadata_wrapper.h | 12 +- io/include/pcl/io/image_rgb24.h | 38 +- io/include/pcl/io/image_yuv422.h | 26 +- io/include/pcl/io/impl/ascii_io.hpp | 2 +- io/include/pcl/io/impl/buffers.hpp | 39 +- io/include/pcl/io/impl/lzf_image_io.hpp | 24 +- io/include/pcl/io/impl/pcd_io.hpp | 271 +- .../io/impl/point_cloud_image_extractors.hpp | 88 +- io/include/pcl/io/impl/synchronized_queue.hpp | 23 +- io/include/pcl/io/impl/vtk_lib_io.hpp | 74 +- io/include/pcl/io/io.h | 6 +- io/include/pcl/io/io_exception.h | 12 +- io/include/pcl/io/low_level_io.h | 17 +- io/include/pcl/io/lzf.h | 6 +- io/include/pcl/io/lzf_image_io.h | 97 +- io/include/pcl/io/obj_io.h | 14 +- io/include/pcl/io/oni_grabber.h | 101 +- io/include/pcl/io/openni2/openni.h | 10 +- io/include/pcl/io/openni2/openni2_convert.h | 5 +- io/include/pcl/io/openni2/openni2_device.h | 70 +- .../pcl/io/openni2/openni2_device_info.h | 11 +- .../pcl/io/openni2/openni2_device_manager.h | 37 +- .../pcl/io/openni2/openni2_frame_listener.h | 19 +- .../pcl/io/openni2/openni2_metadata_wrapper.h | 34 +- .../pcl/io/openni2/openni2_timer_filter.h | 5 +- .../pcl/io/openni2/openni2_video_mode.h | 9 +- .../openni_shift_to_depth_conversion.h | 36 +- io/include/pcl/io/openni2_grabber.h | 116 +- io/include/pcl/io/openni_camera/openni.h | 7 +- .../pcl/io/openni_camera/openni_depth_image.h | 20 +- .../pcl/io/openni_camera/openni_device.h | 107 +- .../io/openni_camera/openni_device_kinect.h | 15 +- .../pcl/io/openni_camera/openni_device_oni.h | 47 +- .../openni_camera/openni_device_primesense.h | 20 +- .../io/openni_camera/openni_device_xtion.h | 18 +- .../pcl/io/openni_camera/openni_driver.h | 31 +- .../pcl/io/openni_camera/openni_exception.h | 10 +- .../pcl/io/openni_camera/openni_image.h | 24 +- .../openni_camera/openni_image_bayer_grbg.h | 25 +- .../pcl/io/openni_camera/openni_image_rgb24.h | 22 +- .../io/openni_camera/openni_image_yuv_422.h | 21 +- .../pcl/io/openni_camera/openni_ir_image.h | 13 +- .../openni_shift_to_depth_conversion.h | 39 +- io/include/pcl/io/openni_grabber.h | 124 +- io/include/pcl/io/pcd_grabber.h | 109 +- io/include/pcl/io/pcd_io.h | 27 +- io/include/pcl/io/ply/byte_order.h | 15 +- io/include/pcl/io/ply/io_operators.h | 5 +- io/include/pcl/io/ply/ply.h | 42 +- io/include/pcl/io/ply/ply_parser.h | 268 +- io/include/pcl/io/ply_io.h | 58 +- io/include/pcl/io/png_io.h | 7 +- .../pcl/io/point_cloud_image_extractors.h | 90 +- .../io/real_sense/real_sense_device_manager.h | 46 +- io/include/pcl/io/real_sense_2_grabber.h | 218 + io/include/pcl/io/real_sense_grabber.h | 35 +- io/include/pcl/io/robot_eye_grabber.h | 43 +- io/include/pcl/io/tar.h | 5 +- io/include/pcl/io/vlp_grabber.h | 31 +- io/include/pcl/io/vtk_io.h | 5 +- io/include/pcl/io/vtk_lib_io.h | 5 +- io/src/ascii_io.cpp | 29 +- io/src/davidsdk_grabber.cpp | 12 +- io/src/debayer.cpp | 45 +- .../depth_sense_device_manager.cpp | 22 +- .../depth_sense/depth_sense_grabber_impl.cpp | 10 +- io/src/depth_sense_grabber.cpp | 2 +- io/src/dinast_grabber.cpp | 32 +- io/src/ensenso_grabber.cpp | 16 +- io/src/fotonic_grabber.cpp | 351 - io/src/hdl_grabber.cpp | 162 +- io/src/ifs_io.cpp | 72 +- io/src/image_depth.cpp | 14 +- io/src/image_grabber.cpp | 152 +- io/src/image_ir.cpp | 6 +- io/src/image_rgb24.cpp | 4 +- io/src/image_yuv422.cpp | 8 +- io/src/libpng_wrapper.cpp | 110 +- io/src/lzf.cpp | 106 +- io/src/lzf_image_io.cpp | 87 +- io/src/obj_io.cpp | 172 +- io/src/oni_grabber.cpp | 106 +- io/src/openni2/openni2_device.cpp | 258 +- io/src/openni2/openni2_device_manager.cpp | 88 +- io/src/openni2/openni2_timer_filter.cpp | 12 +- io/src/openni2_grabber.cpp | 168 +- io/src/openni_camera/openni_depth_image.cpp | 4 +- io/src/openni_camera/openni_device.cpp | 269 +- io/src/openni_camera/openni_device_kinect.cpp | 13 +- io/src/openni_camera/openni_device_oni.cpp | 9 +- .../openni_device_primesense.cpp | 15 +- io/src/openni_camera/openni_device_xtion.cpp | 13 +- io/src/openni_camera/openni_driver.cpp | 65 +- .../openni_camera/openni_image_bayer_grbg.cpp | 73 +- io/src/openni_camera/openni_image_rgb24.cpp | 5 +- io/src/openni_camera/openni_image_yuv_422.cpp | 33 +- io/src/openni_grabber.cpp | 143 +- io/src/pcd_grabber.cpp | 47 +- io/src/pcd_io.cpp | 192 +- io/src/ply/ply_parser.cpp | 695 +- io/src/ply_io.cpp | 488 +- .../real_sense/real_sense_device_manager.cpp | 34 +- io/src/real_sense_2_grabber.cpp | 343 + io/src/real_sense_grabber.cpp | 30 +- io/src/robot_eye_grabber.cpp | 43 +- io/src/vlp_grabber.cpp | 31 +- io/src/vtk_io.cpp | 41 +- io/src/vtk_lib_io.cpp | 92 +- io/tools/CMakeLists.txt | 20 +- io/tools/converter.cpp | 18 +- io/tools/hdl_grabber_example.cpp | 19 +- io/tools/openni_grabber_depth_example.cpp | 9 +- io/tools/openni_grabber_example.cpp | 16 +- io/tools/openni_pcd_recorder.cpp | 108 +- io/tools/pcd_convert_NaN_nan.cpp | 5 +- io/tools/pcd_introduce_nan.cpp | 12 +- io/tools/ply/CMakeLists.txt | 8 +- io/tools/ply/ply2obj.cpp | 94 +- io/tools/ply/ply2ply.cpp | 138 +- io/tools/ply/ply2raw.cpp | 141 +- io/tools/ply/plyheader.cpp | 25 +- kdtree/CMakeLists.txt | 61 +- kdtree/include/pcl/kdtree/flann.h | 13 +- kdtree/include/pcl/kdtree/impl/io.hpp | 5 +- .../include/pcl/kdtree/impl/kdtree_flann.hpp | 28 +- kdtree/include/pcl/kdtree/io.h | 6 +- kdtree/include/pcl/kdtree/kdtree.h | 46 +- kdtree/include/pcl/kdtree/kdtree_flann.h | 50 +- keypoints/CMakeLists.txt | 111 +- keypoints/include/pcl/keypoints/agast_2d.h | 150 +- keypoints/include/pcl/keypoints/brisk_2d.h | 67 +- keypoints/include/pcl/keypoints/harris_2d.h | 25 +- keypoints/include/pcl/keypoints/harris_3d.h | 40 +- keypoints/include/pcl/keypoints/harris_6d.h | 22 +- .../include/pcl/keypoints/impl/agast_2d.hpp | 6 +- .../include/pcl/keypoints/impl/brisk_2d.hpp | 6 +- .../include/pcl/keypoints/impl/harris_2d.hpp | 9 +- .../include/pcl/keypoints/impl/harris_3d.hpp | 26 +- .../include/pcl/keypoints/impl/harris_6d.hpp | 56 +- .../include/pcl/keypoints/impl/iss_3d.hpp | 28 +- .../include/pcl/keypoints/impl/keypoint.hpp | 41 +- .../pcl/keypoints/impl/sift_keypoint.hpp | 28 +- .../impl/smoothed_surfaces_keypoint.hpp | 49 +- .../include/pcl/keypoints/impl/susan.hpp | 154 +- .../pcl/keypoints/impl/trajkovic_2d.hpp | 7 +- .../pcl/keypoints/impl/trajkovic_3d.hpp | 11 +- keypoints/include/pcl/keypoints/iss_3d.h | 31 +- keypoints/include/pcl/keypoints/keypoint.h | 38 +- .../include/pcl/keypoints/narf_keypoint.h | 23 +- .../include/pcl/keypoints/sift_keypoint.h | 21 +- .../keypoints/smoothed_surfaces_keypoint.h | 34 +- keypoints/include/pcl/keypoints/susan.h | 34 +- .../include/pcl/keypoints/trajkovic_2d.h | 21 +- .../include/pcl/keypoints/trajkovic_3d.h | 27 +- .../include/pcl/keypoints/uniform_sampling.h | 6 +- keypoints/src/agast_2d.cpp | 7373 +++-------------- keypoints/src/brisk_2d.cpp | 207 +- keypoints/src/narf_keypoint.cpp | 136 +- ml/CMakeLists.txt | 149 +- ml/include/pcl/ml/branch_estimator.h | 185 +- ml/include/pcl/ml/densecrf.h | 244 +- ml/include/pcl/ml/dt/decision_forest.h | 157 +- .../pcl/ml/dt/decision_forest_evaluator.h | 119 +- .../pcl/ml/dt/decision_forest_trainer.h | 333 +- ml/include/pcl/ml/dt/decision_tree.h | 104 +- .../pcl/ml/dt/decision_tree_data_provider.h | 65 +- .../pcl/ml/dt/decision_tree_evaluator.h | 179 +- ml/include/pcl/ml/dt/decision_tree_trainer.h | 420 +- ml/include/pcl/ml/feature_handler.h | 122 +- ml/include/pcl/ml/ferns/fern.h | 337 +- ml/include/pcl/ml/ferns/fern_evaluator.h | 148 +- ml/include/pcl/ml/ferns/fern_trainer.h | 279 +- .../ml/impl/dt/decision_forest_evaluator.hpp | 114 +- .../ml/impl/dt/decision_forest_trainer.hpp | 56 +- .../ml/impl/dt/decision_tree_evaluator.hpp | 209 +- .../pcl/ml/impl/dt/decision_tree_trainer.hpp | 340 +- .../pcl/ml/impl/ferns/fern_evaluator.hpp | 270 +- ml/include/pcl/ml/impl/ferns/fern_trainer.hpp | 370 +- ml/include/pcl/ml/impl/kmeans.hpp | 161 +- ml/include/pcl/ml/impl/svm/svm_wrapper.hpp | 83 +- ml/include/pcl/ml/kmeans.h | 275 +- .../ml/multi_channel_2d_comparison_feature.h | 87 +- ...ti_channel_2d_comparison_feature_handler.h | 690 +- ml/include/pcl/ml/multi_channel_2d_data_set.h | 382 +- .../pcl/ml/multiple_data_2d_example_index.h | 32 +- ml/include/pcl/ml/pairwise_potential.h | 65 +- ml/include/pcl/ml/permutohedral.h | 433 +- ml/include/pcl/ml/point_xy_32f.h | 94 +- ml/include/pcl/ml/point_xy_32i.h | 93 +- .../ml/regression_variance_stats_estimator.h | 550 +- ml/include/pcl/ml/stats_estimator.h | 206 +- ml/include/pcl/ml/svm.h | 289 +- ml/include/pcl/ml/svm_wrapper.h | 1029 +-- ml/src/densecrf.cpp | 277 +- ml/src/kmeans.cpp | 194 +- ml/src/pairwise_potential.cpp | 99 +- ml/src/permutohedral.cpp | 656 +- ml/src/point_xy_32f.cpp | 25 +- ml/src/point_xy_32i.cpp | 27 +- ml/src/svm.cpp | 3619 ++++---- ml/src/svm_wrapper.cpp | 920 +- octree/CMakeLists.txt | 97 +- octree/include/pcl/octree/boost.h | 5 +- .../pcl/octree/impl/octree2buf_base.hpp | 117 +- .../include/pcl/octree/impl/octree_base.hpp | 35 +- .../pcl/octree/impl/octree_iterator.hpp | 6 +- .../pcl/octree/impl/octree_pointcloud.hpp | 50 +- .../impl/octree_pointcloud_adjacency.hpp | 23 +- .../impl/octree_pointcloud_voxelcentroid.hpp | 7 +- .../include/pcl/octree/impl/octree_search.hpp | 73 +- octree/include/pcl/octree/octree.h | 6 +- octree/include/pcl/octree/octree2buf_base.h | 91 +- octree/include/pcl/octree/octree_base.h | 80 +- octree/include/pcl/octree/octree_container.h | 106 +- octree/include/pcl/octree/octree_impl.h | 5 +- octree/include/pcl/octree/octree_iterator.h | 30 +- octree/include/pcl/octree/octree_key.h | 17 +- octree/include/pcl/octree/octree_node_pool.h | 5 +- octree/include/pcl/octree/octree_nodes.h | 39 +- octree/include/pcl/octree/octree_pointcloud.h | 42 +- .../pcl/octree/octree_pointcloud_adjacency.h | 55 +- .../octree_pointcloud_adjacency_container.h | 25 +- .../octree/octree_pointcloud_changedetector.h | 25 +- .../pcl/octree/octree_pointcloud_density.h | 16 +- .../pcl/octree/octree_pointcloud_occupancy.h | 22 +- .../octree/octree_pointcloud_pointvector.h | 11 +- .../octree/octree_pointcloud_singlepoint.h | 11 +- .../octree/octree_pointcloud_voxelcentroid.h | 32 +- octree/include/pcl/octree/octree_search.h | 50 +- outofcore/CMakeLists.txt | 122 +- outofcore/include/pcl/outofcore/boost.h | 14 +- outofcore/include/pcl/outofcore/cJSON.h | 7 +- .../include/pcl/outofcore/impl/lru_cache.hpp | 30 +- .../pcl/outofcore/impl/monitor_queue.hpp | 10 +- .../pcl/outofcore/impl/octree_base.hpp | 110 +- .../pcl/outofcore/impl/octree_base_node.hpp | 576 +- .../outofcore/impl/octree_disk_container.hpp | 201 +- .../outofcore/impl/octree_ram_container.hpp | 34 +- .../impl/outofcore_breadth_first_iterator.hpp | 8 +- .../impl/outofcore_depth_first_iterator.hpp | 6 +- outofcore/include/pcl/outofcore/metadata.h | 6 +- .../octree_abstract_node_container.h | 25 +- outofcore/include/pcl/outofcore/octree_base.h | 112 +- .../include/pcl/outofcore/octree_base_node.h | 110 +- .../pcl/outofcore/octree_disk_container.h | 67 +- .../pcl/outofcore/octree_ram_container.h | 25 +- outofcore/include/pcl/outofcore/outofcore.h | 5 +- .../pcl/outofcore/outofcore_base_data.h | 42 +- .../outofcore_breadth_first_iterator.h | 19 +- .../outofcore_depth_first_iterator.h | 15 +- .../include/pcl/outofcore/outofcore_impl.h | 6 +- .../pcl/outofcore/outofcore_iterator_base.h | 17 +- .../pcl/outofcore/outofcore_node_data.h | 9 +- .../pcl/outofcore/visualization/axes.h | 14 +- .../pcl/outofcore/visualization/camera.h | 13 +- .../pcl/outofcore/visualization/common.h | 5 +- .../pcl/outofcore/visualization/geometry.h | 9 +- .../pcl/outofcore/visualization/grid.h | 5 +- .../pcl/outofcore/visualization/object.h | 13 +- .../outofcore/visualization/outofcore_cloud.h | 98 +- .../pcl/outofcore/visualization/scene.h | 11 +- .../pcl/outofcore/visualization/viewport.h | 5 +- outofcore/src/cJSON.cpp | 160 +- outofcore/src/outofcore_base_data.cpp | 39 +- outofcore/src/outofcore_node_data.cpp | 17 +- outofcore/src/visualization/camera.cpp | 20 +- outofcore/src/visualization/grid.cpp | 4 - outofcore/src/visualization/object.cpp | 11 +- .../src/visualization/outofcore_cloud.cpp | 63 +- outofcore/src/visualization/scene.cpp | 26 +- outofcore/src/visualization/viewport.cpp | 43 +- outofcore/tools/CMakeLists.txt | 39 +- outofcore/tools/outofcore_print.cpp | 36 +- outofcore/tools/outofcore_process.cpp | 20 +- outofcore/tools/outofcore_viewer.cpp | 23 +- pcl_config.h.in | 9 +- people/CMakeLists.txt | 93 +- .../main_ground_based_people_detection.cpp | 47 +- .../ground_based_people_detection_app.h | 10 +- .../pcl/people/head_based_subcluster.h | 10 +- people/include/pcl/people/height_map_2d.h | 10 +- people/include/pcl/people/hog.h | 6 +- .../ground_based_people_detection_app.hpp | 16 +- .../pcl/people/impl/head_based_subcluster.hpp | 26 +- .../include/pcl/people/impl/height_map_2d.hpp | 18 +- .../pcl/people/impl/person_classifier.hpp | 56 +- .../pcl/people/impl/person_cluster.hpp | 14 +- people/include/pcl/people/person_classifier.h | 8 +- people/include/pcl/people/person_cluster.h | 24 +- people/src/hog.cpp | 259 +- recognition/CMakeLists.txt | 328 +- .../3rdparty/metslib/abstract-search.hh | 5 +- .../3rdparty/metslib/local-search.hh | 8 +- .../pcl/recognition/3rdparty/metslib/model.hh | 28 +- .../3rdparty/metslib/simulated-annealing.hh | 8 +- .../3rdparty/metslib/tabu-search.hh | 10 +- recognition/include/pcl/recognition/boost.h | 7 +- .../recognition/cg/correspondence_grouping.h | 15 +- .../recognition/cg/geometric_consistency.h | 16 +- .../include/pcl/recognition/cg/hough_3d.h | 132 +- .../recognition/color_gradient_dot_modality.h | 370 +- .../pcl/recognition/color_gradient_modality.h | 121 +- .../include/pcl/recognition/color_modality.h | 60 +- .../include/pcl/recognition/crh_alignment.h | 24 +- .../dense_quantized_multi_mod_template.h | 21 +- .../include/pcl/recognition/distance_map.h | 20 +- .../include/pcl/recognition/dot_modality.h | 5 +- recognition/include/pcl/recognition/dotmod.h | 33 +- .../recognition/face_detection/face_common.h | 38 +- .../face_detector_data_provider.h | 56 +- .../face_detection/rf_face_detector_trainer.h | 21 +- .../face_detection/rf_face_utils.h | 91 +- .../pcl/recognition/hv/greedy_verification.h | 25 +- .../include/pcl/recognition/hv/hv_go.h | 82 +- .../include/pcl/recognition/hv/hv_papazov.h | 21 +- .../recognition/hv/hypotheses_verification.h | 12 +- .../pcl/recognition/hv/occlusion_reasoning.h | 23 +- .../impl/cg/geometric_consistency.hpp | 20 +- .../pcl/recognition/impl/cg/hough_3d.hpp | 22 +- .../impl/hv/greedy_verification.hpp | 18 +- .../include/pcl/recognition/impl/hv/hv_go.hpp | 134 +- .../pcl/recognition/impl/hv/hv_papazov.hpp | 38 +- .../impl/hv/occlusion_reasoning.hpp | 19 +- .../recognition/impl/implicit_shape_model.hpp | 131 +- .../recognition/impl/linemod/line_rgbd.hpp | 241 +- .../impl/ransac_based/simple_octree.hpp | 26 +- .../impl/ransac_based/voxel_structure.hpp | 8 +- .../pcl/recognition/implicit_shape_model.h | 40 +- recognition/include/pcl/recognition/linemod.h | 99 +- .../pcl/recognition/linemod/line_rgbd.h | 39 +- .../include/pcl/recognition/mask_map.h | 174 +- .../include/pcl/recognition/point_types.h | 10 +- .../pcl/recognition/quantizable_modality.h | 9 +- .../include/pcl/recognition/quantized_map.h | 41 +- .../pcl/recognition/ransac_based/auxiliary.h | 11 +- .../pcl/recognition/ransac_based/bvh.h | 24 +- .../pcl/recognition/ransac_based/hypothesis.h | 9 +- .../recognition/ransac_based/model_library.h | 25 +- .../recognition/ransac_based/obj_rec_ransac.h | 17 +- .../pcl/recognition/ransac_based/orr_graph.h | 9 +- .../pcl/recognition/ransac_based/orr_octree.h | 31 +- .../ransac_based/orr_octree_zprojection.h | 27 +- .../ransac_based/rigid_transform_space.h | 23 +- .../recognition/ransac_based/simple_octree.h | 7 +- .../recognition/ransac_based/trimmed_icp.h | 17 +- .../ransac_based/voxel_structure.h | 9 +- .../include/pcl/recognition/region_xy.h | 5 +- .../sparse_quantized_multi_mod_template.h | 9 +- .../pcl/recognition/surface_normal_modality.h | 168 +- recognition/src/cg/hough_3d.cpp | 13 +- recognition/src/dotmod.cpp | 51 +- .../face_detector_data_provider.cpp | 94 +- .../rf_face_detector_trainer.cpp | 83 +- recognition/src/linemod.cpp | 355 +- recognition/src/mask_map.cpp | 93 +- recognition/src/quantizable_modality.cpp | 26 +- .../src/ransac_based/model_library.cpp | 18 +- .../src/ransac_based/obj_rec_ransac.cpp | 138 +- recognition/src/ransac_based/orr_octree.cpp | 63 +- .../ransac_based/orr_octree_zprojection.cpp | 83 +- registration/CMakeLists.txt | 330 +- registration/include/pcl/registration/bfgs.h | 25 +- registration/include/pcl/registration/boost.h | 8 +- .../include/pcl/registration/boost_graph.h | 17 +- .../pcl/registration/convergence_criteria.h | 10 +- .../registration/correspondence_estimation.h | 75 +- ...correspondence_estimation_backprojection.h | 33 +- ...orrespondence_estimation_normal_shooting.h | 47 +- ...pondence_estimation_organized_projection.h | 27 +- .../registration/correspondence_rejection.h | 42 +- .../correspondence_rejection_distance.h | 33 +- .../correspondence_rejection_features.h | 57 +- ...correspondence_rejection_median_distance.h | 29 +- .../correspondence_rejection_one_to_one.h | 14 +- ...respondence_rejection_organized_boundary.h | 21 +- .../correspondence_rejection_poly.h | 53 +- ...orrespondence_rejection_sample_consensus.h | 35 +- ...espondence_rejection_sample_consensus_2d.h | 19 +- .../correspondence_rejection_surface_normal.h | 37 +- .../correspondence_rejection_trimmed.h | 16 +- .../correspondence_rejection_var_trimmed.h | 31 +- .../pcl/registration/correspondence_sorting.h | 36 +- .../pcl/registration/correspondence_types.h | 6 +- .../default_convergence_criteria.h | 32 +- .../include/pcl/registration/distances.h | 8 +- .../pcl/registration/edge_measurements.h | 9 +- registration/include/pcl/registration/eigen.h | 5 +- registration/include/pcl/registration/elch.h | 39 +- .../include/pcl/registration/exceptions.h | 13 +- registration/include/pcl/registration/gicp.h | 72 +- .../include/pcl/registration/gicp6d.h | 28 +- .../include/pcl/registration/graph_handler.h | 17 +- .../pcl/registration/graph_optimizer.h | 5 +- .../pcl/registration/graph_registration.h | 13 +- .../include/pcl/registration/ia_fpcs.h | 35 +- .../include/pcl/registration/ia_kfpcs.h | 43 +- .../include/pcl/registration/ia_ransac.h | 65 +- registration/include/pcl/registration/icp.h | 161 +- .../include/pcl/registration/icp_nl.h | 11 +- ...rrespondence_estimation_backprojection.hpp | 8 +- ...respondence_estimation_normal_shooting.hpp | 8 +- ...ndence_estimation_organized_projection.hpp | 4 +- .../correspondence_rejection_features.hpp | 10 +- .../impl/correspondence_rejection_poly.hpp | 4 +- ...respondence_rejection_sample_consensus.hpp | 71 +- ...pondence_rejection_sample_consensus_2d.hpp | 61 +- .../impl/correspondence_types.hpp | 10 +- .../impl/default_convergence_criteria.hpp | 65 +- .../include/pcl/registration/impl/elch.hpp | 25 +- .../include/pcl/registration/impl/gicp.hpp | 31 +- .../include/pcl/registration/impl/ia_fpcs.hpp | 82 +- .../pcl/registration/impl/ia_kfpcs.hpp | 23 +- .../pcl/registration/impl/ia_ransac.hpp | 12 +- .../include/pcl/registration/impl/icp.hpp | 30 +- .../impl/incremental_registration.hpp | 2 +- .../pcl/registration/impl/joint_icp.hpp | 32 +- .../include/pcl/registration/impl/lum.hpp | 28 +- .../include/pcl/registration/impl/ndt.hpp | 99 +- .../include/pcl/registration/impl/ndt_2d.hpp | 74 +- .../registration/impl/ppf_registration.hpp | 61 +- .../impl/pyramid_feature_matching.hpp | 61 +- .../pcl/registration/impl/registration.hpp | 13 +- .../impl/sample_consensus_prerejective.hpp | 10 +- .../impl/transformation_estimation_2D.hpp | 10 +- .../impl/transformation_estimation_dq.hpp | 2 +- ...nsformation_estimation_dual_quaternion.hpp | 2 +- .../impl/transformation_estimation_lm.hpp | 12 +- ...ormation_estimation_point_to_plane_lls.hpp | 44 +- ...estimation_point_to_plane_lls_weighted.hpp | 46 +- ...ion_estimation_point_to_plane_weighted.hpp | 5 +- .../impl/transformation_estimation_svd.hpp | 2 +- ...stimation_symmetric_point_to_plane_lls.hpp | 204 + .../transformation_validation_euclidean.hpp | 7 +- .../registration/incremental_registration.h | 13 +- .../include/pcl/registration/joint_icp.h | 59 +- registration/include/pcl/registration/lum.h | 33 +- .../pcl/registration/matching_candidate.h | 12 +- .../pcl/registration/meta_registration.h | 13 +- registration/include/pcl/registration/ndt.h | 46 +- .../include/pcl/registration/ndt_2d.h | 31 +- .../pairwise_graph_registration.h | 9 +- .../pcl/registration/ppf_registration.h | 56 +- .../registration/pyramid_feature_matching.h | 30 +- .../include/pcl/registration/registration.h | 90 +- .../sample_consensus_prerejective.h | 41 +- .../registration/transformation_estimation.h | 12 +- .../transformation_estimation_2D.h | 12 +- .../transformation_estimation_3point.h | 30 +- .../transformation_estimation_dq.h | 12 +- ...ransformation_estimation_dual_quaternion.h | 22 +- .../transformation_estimation_lm.h | 58 +- ...transformation_estimation_point_to_plane.h | 35 +- ...sformation_estimation_point_to_plane_lls.h | 22 +- ...n_estimation_point_to_plane_lls_weighted.h | 12 +- ...ation_estimation_point_to_plane_weighted.h | 44 +- .../transformation_estimation_svd.h | 22 +- .../transformation_estimation_svd_scale.h | 12 +- ..._estimation_symmetric_point_to_plane_lls.h | 162 + .../registration/transformation_validation.h | 24 +- .../transformation_validation_euclidean.h | 33 +- .../include/pcl/registration/transforms.h | 6 +- .../pcl/registration/vertex_estimates.h | 5 +- .../pcl/registration/warp_point_rigid.h | 18 +- .../pcl/registration/warp_point_rigid_3d.h | 21 +- .../pcl/registration/warp_point_rigid_6d.h | 23 +- .../src/correspondence_rejection_distance.cpp | 10 +- .../src/correspondence_rejection_features.cpp | 7 +- ...rrespondence_rejection_median_distance.cpp | 4 +- .../correspondence_rejection_one_to_one.cpp | 10 +- ...spondence_rejection_organized_boundary.cpp | 12 +- ...orrespondence_rejection_surface_normal.cpp | 6 +- .../correspondence_rejection_var_trimmed.cpp | 10 +- registration/src/gicp6d.cpp | 22 +- registration/src/ppf_registration.cpp | 32 +- registration/src/registration.cpp | 4 +- sample_consensus/CMakeLists.txt | 166 +- .../include/pcl/sample_consensus/boost.h | 5 +- .../include/pcl/sample_consensus/eigen.h | 5 +- .../pcl/sample_consensus/impl/lmeds.hpp | 4 +- .../pcl/sample_consensus/impl/mlesac.hpp | 50 +- .../pcl/sample_consensus/impl/msac.hpp | 18 +- .../pcl/sample_consensus/impl/prosac.hpp | 22 +- .../pcl/sample_consensus/impl/ransac.hpp | 191 +- .../pcl/sample_consensus/impl/rmsac.hpp | 20 +- .../pcl/sample_consensus/impl/rransac.hpp | 56 +- .../impl/sac_model_circle.hpp | 72 +- .../impl/sac_model_circle3d.hpp | 35 +- .../sample_consensus/impl/sac_model_cone.hpp | 66 +- .../impl/sac_model_cylinder.hpp | 66 +- .../sample_consensus/impl/sac_model_line.hpp | 49 +- .../impl/sac_model_normal_parallel_plane.hpp | 4 +- .../impl/sac_model_normal_plane.hpp | 28 +- .../impl/sac_model_normal_sphere.hpp | 42 +- .../impl/sac_model_parallel_line.hpp | 4 +- .../impl/sac_model_parallel_plane.hpp | 4 +- .../impl/sac_model_perpendicular_plane.hpp | 4 +- .../sample_consensus/impl/sac_model_plane.hpp | 50 +- .../impl/sac_model_registration.hpp | 14 +- .../impl/sac_model_registration_2d.hpp | 10 +- .../impl/sac_model_sphere.hpp | 32 +- .../sample_consensus/impl/sac_model_stick.hpp | 38 +- .../include/pcl/sample_consensus/lmeds.h | 14 +- .../pcl/sample_consensus/method_types.h | 5 +- .../include/pcl/sample_consensus/mlesac.h | 28 +- .../pcl/sample_consensus/model_types.h | 5 +- .../include/pcl/sample_consensus/msac.h | 13 +- .../include/pcl/sample_consensus/prosac.h | 13 +- .../include/pcl/sample_consensus/ransac.h | 18 +- .../include/pcl/sample_consensus/rmsac.h | 15 +- .../include/pcl/sample_consensus/rransac.h | 16 +- .../include/pcl/sample_consensus/sac.h | 65 +- .../include/pcl/sample_consensus/sac_model.h | 101 +- .../pcl/sample_consensus/sac_model_circle.h | 49 +- .../pcl/sample_consensus/sac_model_circle3d.h | 43 +- .../pcl/sample_consensus/sac_model_cone.h | 56 +- .../pcl/sample_consensus/sac_model_cylinder.h | 56 +- .../pcl/sample_consensus/sac_model_line.h | 38 +- .../sac_model_normal_parallel_plane.h | 44 +- .../sample_consensus/sac_model_normal_plane.h | 35 +- .../sac_model_normal_sphere.h | 47 +- .../sac_model_parallel_line.h | 32 +- .../sac_model_parallel_plane.h | 41 +- .../sac_model_perpendicular_plane.h | 39 +- .../pcl/sample_consensus/sac_model_plane.h | 44 +- .../sample_consensus/sac_model_registration.h | 60 +- .../sac_model_registration_2d.h | 25 +- .../pcl/sample_consensus/sac_model_sphere.h | 49 +- .../pcl/sample_consensus/sac_model_stick.h | 41 +- sample_consensus/sample_consensus.doxy | 8 +- search/CMakeLists.txt | 78 +- search/include/pcl/search/brute_force.h | 19 +- search/include/pcl/search/flann_search.h | 68 +- .../include/pcl/search/impl/brute_force.hpp | 42 +- .../include/pcl/search/impl/flann_search.hpp | 54 +- search/include/pcl/search/impl/organized.hpp | 20 +- search/include/pcl/search/impl/search.hpp | 37 +- search/include/pcl/search/kdtree.h | 34 +- search/include/pcl/search/octree.h | 39 +- search/include/pcl/search/organized.h | 38 +- search/include/pcl/search/pcl_search.h | 6 +- search/include/pcl/search/search.h | 39 +- segmentation/CMakeLists.txt | 215 +- ...oximate_progressive_morphological_filter.h | 10 +- segmentation/include/pcl/segmentation/boost.h | 11 +- .../include/pcl/segmentation/comparator.h | 18 +- .../conditional_euclidean_clustering.h | 25 +- .../pcl/segmentation/cpc_segmentation.h | 49 +- .../segmentation/crf_normal_segmentation.h | 30 +- .../pcl/segmentation/crf_segmentation.h | 11 +- .../edge_aware_plane_comparator.h | 25 +- .../euclidean_cluster_comparator.h | 72 +- .../euclidean_plane_coefficient_comparator.h | 25 +- .../pcl/segmentation/extract_clusters.h | 61 +- .../segmentation/extract_labeled_clusters.h | 27 +- .../extract_polygonal_prism_data.h | 17 +- .../pcl/segmentation/grabcut_segmentation.h | 50 +- .../segmentation/ground_plane_comparator.h | 53 +- ...imate_progressive_morphological_filter.hpp | 6 +- .../segmentation/impl/cpc_segmentation.hpp | 82 +- .../segmentation/impl/crf_segmentation.hpp | 109 +- .../segmentation/impl/extract_clusters.hpp | 36 +- .../impl/extract_labeled_clusters.hpp | 22 +- .../impl/extract_polygonal_prism_data.hpp | 14 +- .../impl/grabcut_segmentation.hpp | 59 +- .../segmentation/impl/lccp_segmentation.hpp | 80 +- .../impl/min_cut_segmentation.hpp | 50 +- ...nized_connected_component_segmentation.hpp | 20 +- .../organized_multi_plane_segmentation.hpp | 40 +- .../impl/progressive_morphological_filter.hpp | 4 +- .../pcl/segmentation/impl/random_walker.hpp | 83 +- .../pcl/segmentation/impl/region_growing.hpp | 61 +- .../segmentation/impl/region_growing_rgb.hpp | 17 +- .../segmentation/impl/sac_segmentation.hpp | 7 +- .../impl/seeded_hue_segmentation.hpp | 50 +- .../segmentation/impl/segment_differences.hpp | 4 +- .../impl/supervoxel_clustering.hpp | 115 +- .../segmentation/impl/unary_classifier.hpp | 67 +- .../pcl/segmentation/lccp_segmentation.h | 63 +- .../pcl/segmentation/min_cut_segmentation.h | 72 +- ...ganized_connected_component_segmentation.h | 25 +- .../organized_multi_plane_segmentation.h | 61 +- .../pcl/segmentation/planar_polygon_fusion.h | 7 +- .../include/pcl/segmentation/planar_region.h | 18 +- .../plane_coefficient_comparator.h | 45 +- .../plane_refinement_comparator.h | 57 +- .../progressive_morphological_filter.h | 10 +- .../include/pcl/segmentation/random_walker.h | 10 +- .../include/pcl/segmentation/region_3d.h | 29 +- .../include/pcl/segmentation/region_growing.h | 24 +- .../pcl/segmentation/region_growing_rgb.h | 38 +- .../rgb_plane_coefficient_comparator.h | 25 +- .../pcl/segmentation/sac_segmentation.h | 62 +- .../segmentation/seeded_hue_segmentation.h | 47 +- .../pcl/segmentation/segment_differences.h | 27 +- .../pcl/segmentation/supervoxel_clustering.h | 201 +- .../pcl/segmentation/unary_classifier.h | 8 +- segmentation/src/grabcut_segmentation.cpp | 10 +- segmentation/src/min_cut_segmentation.cpp | 3 - segmentation/src/supervoxel_clustering.cpp | 24 +- segmentation/src/unary_classifier.cpp | 2 + simulation/CMakeLists.txt | 78 +- simulation/include/pcl/simulation/camera.h | 290 +- .../include/pcl/simulation/glsl_shader.h | 204 +- simulation/include/pcl/simulation/model.h | 372 +- .../include/pcl/simulation/range_likelihood.h | 556 +- simulation/include/pcl/simulation/scene.h | 47 +- .../include/pcl/simulation/sum_reduce.h | 86 +- simulation/src/camera.cpp | 59 +- simulation/src/compute_score.frag | 2 +- simulation/src/glsl_shader.cpp | 194 +- simulation/src/model.cpp | 436 +- simulation/src/range_likelihood.cpp | 1440 ++-- simulation/src/scene.cpp | 25 +- simulation/src/sum_reduce.cpp | 139 +- simulation/tools/CMakeLists.txt | 72 +- simulation/tools/sim_terminal_demo.cpp | 242 +- simulation/tools/sim_test_performance.cpp | 497 +- simulation/tools/sim_test_simple.cpp | 729 +- simulation/tools/sim_viewer.cpp | 1209 ++- simulation/tools/simulation_io.cpp | 386 +- simulation/tools/simulation_io.hpp | 92 +- stereo/CMakeLists.txt | 55 +- .../pcl/stereo/digital_elevation_map.h | 183 +- .../pcl/stereo/disparity_map_converter.h | 426 +- .../stereo/impl/disparity_map_converter.hpp | 241 +- stereo/include/pcl/stereo/stereo_grabber.h | 276 +- stereo/include/pcl/stereo/stereo_matching.h | 940 ++- stereo/src/digital_elevation_map.cpp | 143 +- stereo/src/disparity_map_converter.cpp | 3 +- stereo/src/stereo_adaptive_cost_so.cpp | 264 +- stereo/src/stereo_block_based.cpp | 147 +- stereo/src/stereo_grabber.cpp | 195 +- stereo/src/stereo_matching.cpp | 574 +- surface/CMakeLists.txt | 346 +- .../opennurbs/opennurbs_annotation2.h | 9 +- .../3rdparty/opennurbs/opennurbs_archive.h | 204 +- .../3rdparty/opennurbs/opennurbs_array_defs.h | 10 +- .../3rdparty/opennurbs/opennurbs_base64.h | 8 +- .../3rdparty/opennurbs/opennurbs_bitmap.h | 2 +- .../3rdparty/opennurbs/opennurbs_crc.h | 4 +- .../3rdparty/opennurbs/opennurbs_defines.h | 4 +- .../3rdparty/opennurbs/opennurbs_extensions.h | 26 +- .../3rdparty/opennurbs/opennurbs_fsp.h | 66 +- .../3rdparty/opennurbs/opennurbs_fsp_defs.h | 16 +- .../3rdparty/opennurbs/opennurbs_hatch.h | 11 +- .../opennurbs/opennurbs_hsort_template.h | 4 +- .../3rdparty/opennurbs/opennurbs_light.h | 10 +- .../3rdparty/opennurbs/opennurbs_lookup.h | 30 +- .../3rdparty/opennurbs/opennurbs_math.h | 2 +- .../opennurbs/opennurbs_qsort_template.h | 4 +- .../3rdparty/opennurbs/opennurbs_rand.h | 2 +- .../3rdparty/opennurbs/opennurbs_rtree.h | 18 +- .../3rdparty/opennurbs/opennurbs_string.h | 52 +- .../3rdparty/opennurbs/opennurbs_workspace.h | 24 +- .../3rdparty/opennurbs/opennurbs_zlib.h | 18 +- .../pcl/surface/3rdparty/poisson4/allocator.h | 4 +- .../3rdparty/poisson4/bspline_data.hpp | 4 +- .../pcl/surface/3rdparty/poisson4/geometry.h | 4 +- .../surface/3rdparty/poisson4/geometry.hpp | 4 +- .../pcl/surface/3rdparty/poisson4/hash.h | 32 - .../pcl/surface/3rdparty/poisson4/mat.h | 4 +- .../pcl/surface/3rdparty/poisson4/mat.hpp | 24 +- .../poisson4/multi_grid_octree_data.h | 12 +- .../poisson4/multi_grid_octree_data.hpp | 136 +- .../3rdparty/poisson4/octree_poisson.hpp | 17 +- .../3rdparty/poisson4/poisson_exceptions.h | 151 + .../surface/3rdparty/poisson4/ppolynomial.h | 6 +- .../surface/3rdparty/poisson4/ppolynomial.hpp | 24 +- .../3rdparty/poisson4/sparse_matrix.hpp | 9 +- .../pcl/surface/3rdparty/poisson4/vector.h | 40 +- .../pcl/surface/3rdparty/poisson4/vector.hpp | 112 +- .../pcl/surface/bilateral_upsampling.h | 25 +- surface/include/pcl/surface/boost.h | 9 +- surface/include/pcl/surface/concave_hull.h | 28 +- surface/include/pcl/surface/convex_hull.h | 39 +- surface/include/pcl/surface/ear_clipping.h | 19 +- surface/include/pcl/surface/eigen.h | 5 +- surface/include/pcl/surface/gp3.h | 76 +- surface/include/pcl/surface/grid_projection.h | 31 +- .../pcl/surface/impl/bilateral_upsampling.hpp | 24 +- .../include/pcl/surface/impl/concave_hull.hpp | 37 +- .../include/pcl/surface/impl/convex_hull.hpp | 38 +- surface/include/pcl/surface/impl/gp3.hpp | 92 +- .../pcl/surface/impl/grid_projection.hpp | 102 +- .../pcl/surface/impl/marching_cubes.hpp | 8 +- .../pcl/surface/impl/marching_cubes_hoppe.hpp | 1 - .../pcl/surface/impl/marching_cubes_rbf.hpp | 5 +- surface/include/pcl/surface/impl/mls.hpp | 139 +- .../pcl/surface/impl/organized_fast_mesh.hpp | 6 +- surface/include/pcl/surface/impl/poisson.hpp | 6 +- .../pcl/surface/impl/surfel_smoothing.hpp | 38 +- .../pcl/surface/impl/texture_mapping.hpp | 154 +- surface/include/pcl/surface/marching_cubes.h | 31 +- .../pcl/surface/marching_cubes_hoppe.h | 21 +- .../include/pcl/surface/marching_cubes_rbf.h | 21 +- surface/include/pcl/surface/mls.h | 106 +- .../pcl/surface/on_nurbs/closing_boundary.h | 5 +- .../pcl/surface/on_nurbs/fitting_curve_2d.h | 5 +- .../surface/on_nurbs/fitting_curve_2d_apdm.h | 5 +- .../surface/on_nurbs/fitting_curve_2d_asdm.h | 25 +- .../surface/on_nurbs/fitting_curve_2d_atdm.h | 23 +- .../surface/on_nurbs/fitting_curve_2d_pdm.h | 5 +- .../surface/on_nurbs/fitting_curve_2d_sdm.h | 25 +- .../surface/on_nurbs/fitting_curve_2d_tdm.h | 23 +- .../pcl/surface/on_nurbs/fitting_curve_pdm.h | 5 +- .../surface/on_nurbs/fitting_cylinder_pdm.h | 5 +- .../pcl/surface/on_nurbs/fitting_sphere_pdm.h | 5 +- .../pcl/surface/on_nurbs/fitting_surface_im.h | 11 +- .../surface/on_nurbs/fitting_surface_pdm.h | 8 +- .../surface/on_nurbs/fitting_surface_tdm.h | 33 +- .../on_nurbs/global_optimization_pdm.h | 5 +- .../on_nurbs/global_optimization_tdm.h | 57 +- .../include/pcl/surface/on_nurbs/nurbs_data.h | 16 +- .../pcl/surface/on_nurbs/nurbs_solve.h | 8 +- .../pcl/surface/on_nurbs/nurbs_tools.h | 5 +- .../pcl/surface/on_nurbs/sequential_fitter.h | 8 +- .../include/pcl/surface/on_nurbs/sparse_mat.h | 7 +- .../pcl/surface/on_nurbs/triangulation.h | 5 +- .../include/pcl/surface/organized_fast_mesh.h | 33 +- surface/include/pcl/surface/poisson.h | 24 +- surface/include/pcl/surface/processing.h | 20 +- surface/include/pcl/surface/qhull.h | 7 +- surface/include/pcl/surface/reconstruction.h | 36 +- .../simplification_remove_unused_vertices.h | 9 +- .../include/pcl/surface/surfel_smoothing.h | 25 +- surface/include/pcl/surface/texture_mapping.h | 41 +- .../include/pcl/surface/vtk_smoothing/vtk.h | 7 +- .../vtk_mesh_quadric_decimation.h | 6 +- .../vtk_mesh_smoothing_laplacian.h | 10 +- .../vtk_mesh_smoothing_windowed_sinc.h | 9 +- .../vtk_smoothing/vtk_mesh_subdivision.h | 6 +- .../pcl/surface/vtk_smoothing/vtk_utils.h | 5 +- .../src/3rdparty/opennurbs/openNURBS.cmake | 4 +- .../opennurbs/opennurbs_3dm_settings.cpp | 8 +- .../opennurbs/opennurbs_annotation.cpp | 2 +- .../opennurbs/opennurbs_annotation2.cpp | 39 +- .../3rdparty/opennurbs/opennurbs_archive.cpp | 400 +- .../3rdparty/opennurbs/opennurbs_array.cpp | 4 +- .../3rdparty/opennurbs/opennurbs_base64.cpp | 12 +- .../src/3rdparty/opennurbs/opennurbs_beam.cpp | 2 +- .../3rdparty/opennurbs/opennurbs_bezier.cpp | 15 +- .../opennurbs/opennurbs_beziervolume.cpp | 8 +- .../3rdparty/opennurbs/opennurbs_bitmap.cpp | 24 +- .../opennurbs/opennurbs_bounding_box.cpp | 3 +- .../opennurbs/opennurbs_brep_region.cpp | 4 +- .../opennurbs/opennurbs_brep_tools.cpp | 18 +- .../3rdparty/opennurbs/opennurbs_compress.cpp | 4 +- .../src/3rdparty/opennurbs/opennurbs_cone.cpp | 2 +- .../src/3rdparty/opennurbs/opennurbs_crc.cpp | 4 +- .../3rdparty/opennurbs/opennurbs_curve.cpp | 32 +- .../opennurbs/opennurbs_curveonsurface.cpp | 18 +- .../3rdparty/opennurbs/opennurbs_cylinder.cpp | 2 +- .../3rdparty/opennurbs/opennurbs_defines.cpp | 4 +- .../3rdparty/opennurbs/opennurbs_dimstyle.cpp | 6 +- .../opennurbs/opennurbs_embedded_file.cpp | 84 +- .../3rdparty/opennurbs/opennurbs_error.cpp | 2 +- .../opennurbs/opennurbs_error_message.cpp | 2 +- .../opennurbs/opennurbs_evaluate_nurbs.cpp | 2 +- .../opennurbs/opennurbs_extensions.cpp | 34 +- .../src/3rdparty/opennurbs/opennurbs_font.cpp | 6 +- .../src/3rdparty/opennurbs/opennurbs_fsp.cpp | 42 +- .../3rdparty/opennurbs/opennurbs_geometry.cpp | 4 +- .../3rdparty/opennurbs/opennurbs_group.cpp | 2 +- .../3rdparty/opennurbs/opennurbs_hatch.cpp | 8 +- .../3rdparty/opennurbs/opennurbs_instance.cpp | 10 +- .../src/3rdparty/opennurbs/opennurbs_knot.cpp | 2 +- .../3rdparty/opennurbs/opennurbs_layer.cpp | 20 +- .../3rdparty/opennurbs/opennurbs_light.cpp | 21 +- .../opennurbs/opennurbs_linecurve.cpp | 18 +- .../3rdparty/opennurbs/opennurbs_lookup.cpp | 66 +- .../3rdparty/opennurbs/opennurbs_material.cpp | 4 +- .../src/3rdparty/opennurbs/opennurbs_math.cpp | 36 +- .../3rdparty/opennurbs/opennurbs_matrix.cpp | 5 +- .../src/3rdparty/opennurbs/opennurbs_mesh.cpp | 50 +- .../opennurbs/opennurbs_mesh_ngon.cpp | 2 +- .../opennurbs/opennurbs_mesh_tools.cpp | 2 +- .../3rdparty/opennurbs/opennurbs_morph.cpp | 2 +- .../opennurbs/opennurbs_nurbscurve.cpp | 19 +- .../opennurbs/opennurbs_nurbssurface.cpp | 23 +- .../opennurbs/opennurbs_nurbsvolume.cpp | 8 +- .../3rdparty/opennurbs/opennurbs_object.cpp | 6 +- .../opennurbs/opennurbs_object_history.cpp | 2 +- .../opennurbs/opennurbs_offsetsurface.cpp | 2 +- .../opennurbs/opennurbs_planesurface.cpp | 44 +- .../3rdparty/opennurbs/opennurbs_point.cpp | 9 +- .../opennurbs/opennurbs_pointcloud.cpp | 4 +- .../opennurbs/opennurbs_pointgrid.cpp | 4 +- .../opennurbs/opennurbs_polycurve.cpp | 4 +- .../opennurbs/opennurbs_polyedgecurve.cpp | 4 +- .../opennurbs/opennurbs_polylinecurve.cpp | 14 +- .../src/3rdparty/opennurbs/opennurbs_rand.cpp | 8 +- .../3rdparty/opennurbs/opennurbs_rtree.cpp | 46 +- .../src/3rdparty/opennurbs/opennurbs_sort.cpp | 26 +- .../3rdparty/opennurbs/opennurbs_string.cpp | 58 +- .../opennurbs/opennurbs_sumsurface.cpp | 4 +- .../3rdparty/opennurbs/opennurbs_surface.cpp | 36 +- .../3rdparty/opennurbs/opennurbs_userdata.cpp | 36 +- .../src/3rdparty/opennurbs/opennurbs_uuid.cpp | 6 +- .../opennurbs/opennurbs_workspace.cpp | 28 +- .../3rdparty/opennurbs/opennurbs_wstring.cpp | 26 +- .../src/3rdparty/opennurbs/opennurbs_zlib.cpp | 84 +- .../poisson4/marching_cubes_poisson.cpp | 1 + surface/src/concave_hull.cpp | 2 - surface/src/ear_clipping.cpp | 14 +- surface/src/on_nurbs/closing_boundary.cpp | 15 +- surface/src/on_nurbs/fitting_curve_2d.cpp | 50 +- .../src/on_nurbs/fitting_curve_2d_apdm.cpp | 77 +- .../src/on_nurbs/fitting_curve_2d_asdm.cpp | 16 +- .../src/on_nurbs/fitting_curve_2d_atdm.cpp | 8 +- surface/src/on_nurbs/fitting_curve_2d_pdm.cpp | 60 +- surface/src/on_nurbs/fitting_curve_2d_sdm.cpp | 2 +- surface/src/on_nurbs/fitting_curve_pdm.cpp | 35 +- surface/src/on_nurbs/fitting_cylinder_pdm.cpp | 47 +- surface/src/on_nurbs/fitting_sphere_pdm.cpp | 39 +- surface/src/on_nurbs/fitting_surface_im.cpp | 61 +- surface/src/on_nurbs/fitting_surface_pdm.cpp | 168 +- surface/src/on_nurbs/fitting_surface_tdm.cpp | 6 +- .../src/on_nurbs/global_optimization_pdm.cpp | 36 +- .../src/on_nurbs/global_optimization_tdm.cpp | 30 +- surface/src/on_nurbs/nurbs_solve_eigen.cpp | 12 +- surface/src/on_nurbs/nurbs_solve_umfpack.cpp | 15 +- surface/src/on_nurbs/nurbs_tools.cpp | 56 +- surface/src/on_nurbs/on_nurbs.cmake | 102 +- surface/src/on_nurbs/sequential_fitter.cpp | 39 +- surface/src/on_nurbs/triangulation.cpp | 59 +- .../simplification_remove_unused_vertices.cpp | 24 +- .../vtk_mesh_quadric_decimation.cpp | 7 +- .../vtk_mesh_smoothing_laplacian.cpp | 4 - .../vtk_mesh_smoothing_windowed_sinc.cpp | 4 - .../vtk_smoothing/vtk_mesh_subdivision.cpp | 7 +- surface/src/vtk_smoothing/vtk_utils.cpp | 16 +- test/2d/CMakeLists.txt | 33 +- test/2d/test_2d.cpp | 8 +- test/CMakeLists.txt | 57 +- test/common/CMakeLists.txt | 60 +- test/common/test_bearing_angle_image.cpp | 2 +- test/common/test_centroid.cpp | 38 +- test/common/test_common.cpp | 83 +- test/common/test_copy_make_borders.cpp | 16 +- test/common/test_eigen.cpp | 229 +- test/common/test_gaussian.cpp | 6 +- test/common/test_geometry.cpp | 2 +- test/common/test_intensity.cpp | 7 +- test/common/test_io.cpp | 128 +- test/common/test_macros.cpp | 4 +- test/common/test_operators.cpp | 6 +- test/common/test_pca.cpp | 12 +- test/common/test_polygon_mesh.cpp | 134 + test/common/test_spring.cpp | 12 +- test/common/test_transforms.cpp | 34 +- test/common/test_type_traits.cpp | 170 + test/common/test_vector_average.cpp | 10 +- test/common/test_wrappers.cpp | 14 +- test/features/CMakeLists.txt | 206 +- test/features/test_base_feature.cpp | 20 +- test/features/test_board_estimation.cpp | 12 +- test/features/test_boundary_estimation.cpp | 15 +- test/features/test_brisk.cpp | 12 +- test/features/test_cppf_estimation.cpp | 24 +- test/features/test_curvatures_estimation.cpp | 24 +- test/features/test_cvfh_estimation.cpp | 10 +- test/features/test_flare_estimation.cpp | 4 +- test/features/test_gasd_estimation.cpp | 14 +- test/features/test_gradient_estimation.cpp | 4 +- test/features/test_grsd_estimation.cpp | 4 +- test/features/test_ii_normals.cpp | 86 +- test/features/test_invariants_estimation.cpp | 14 +- test/features/test_narf.cpp | 2 +- test/features/test_normal_estimation.cpp | 48 +- test/features/test_pfh_estimation.cpp | 103 +- test/features/test_ppf_estimation.cpp | 16 +- test/features/test_rift_estimation.cpp | 18 +- test/features/test_rops_estimation.cpp | 2 +- test/features/test_rsd_estimation.cpp | 9 +- test/features/test_shot_estimation.cpp | 112 +- test/features/test_shot_lrf_estimation.cpp | 12 +- test/features/test_spin_estimation.cpp | 16 +- test/filters/CMakeLists.txt | 94 +- test/filters/test_bilateral.cpp | 10 +- test/filters/test_clipper.cpp | 358 +- test/filters/test_convolution.cpp | 20 +- test/filters/test_filters.cpp | 244 +- test/filters/test_sampling.cpp | 12 +- test/filters/test_uniform_sampling.cpp | 82 + test/geometry/CMakeLists.txt | 94 +- test/geometry/test_iterator.cpp | 22 +- test/geometry/test_mesh.cpp | 84 +- test/geometry/test_mesh_circulators.cpp | 64 +- test/geometry/test_mesh_common_functions.h | 47 +- test/geometry/test_mesh_conversion.cpp | 93 +- test/geometry/test_mesh_data.cpp | 54 +- test/geometry/test_mesh_get_boundary.cpp | 24 +- test/geometry/test_mesh_indices.cpp | 14 +- test/geometry/test_mesh_io.cpp | 12 +- test/geometry/test_polygon_mesh.cpp | 48 +- test/geometry/test_quad_mesh.cpp | 52 +- test/geometry/test_triangle_mesh.cpp | 50 +- test/io/CMakeLists.txt | 76 +- test/io/test_buffers.cpp | 14 +- test/io/test_grabbers.cpp | 240 +- test/io/test_io.cpp | 303 +- test/io/test_iterators.cpp | 4 +- test/io/test_ply_io.cpp | 119 +- test/io/test_ply_mesh_io.cpp | 26 +- test/io/test_point_cloud_image_extractors.cpp | 78 +- test/io/test_range_coder.cpp | 12 +- test/kdtree/CMakeLists.txt | 16 +- test/kdtree/test_kdtree.cpp | 107 +- test/keypoints/CMakeLists.txt | 24 +- test/keypoints/test_iss_3d.cpp | 8 +- test/keypoints/test_keypoints.cpp | 14 +- test/octree/CMakeLists.txt | 18 +- test/octree/test_octree.cpp | 353 +- test/octree/test_octree_iterator.cpp | 480 +- test/outofcore/CMakeLists.txt | 16 +- test/outofcore/test_outofcore.cpp | 118 +- test/people/CMakeLists.txt | 16 +- ...t_people_groundBasedPeopleDetectionApp.cpp | 14 +- test/recognition/CMakeLists.txt | 26 +- test/recognition/test_recognition_cg.cpp | 42 +- test/recognition/test_recognition_ism.cpp | 5 +- test/registration/CMakeLists.txt | 80 +- .../test_correspondence_estimation.cpp | 14 +- .../test_correspondence_rejectors.cpp | 26 +- test/registration/test_fpcs_ia.cpp | 2 +- test/registration/test_fpcs_ia_data.h | 5 +- test/registration/test_kfpcs_ia_data.h | 5 +- test/registration/test_ndt.cpp | 119 + test/registration/test_registration.cpp | 308 +- test/registration/test_registration_api.cpp | 114 +- .../registration/test_registration_api_data.h | 6 +- test/registration/test_sac_ia.cpp | 261 + test/sample_consensus/CMakeLists.txt | 36 +- .../test_sample_consensus.cpp | 92 +- .../test_sample_consensus_line_models.cpp | 46 +- .../test_sample_consensus_plane_models.cpp | 20 +- .../test_sample_consensus_quadric_models.cpp | 12 +- test/search/CMakeLists.txt | 43 +- test/search/test_auto_search.cpp | 65 +- test/search/test_flann_search.cpp | 92 +- test/search/test_kdtree.cpp | 54 +- test/search/test_octree.cpp | 66 +- test/search/test_organized.cpp | 109 +- test/search/test_organized_index.cpp | 258 +- test/search/test_search.cpp | 155 +- test/segmentation/CMakeLists.txt | 29 +- test/segmentation/test_random_walker.cpp | 76 +- test/segmentation/test_segmentation.cpp | 7 +- test/surface/CMakeLists.txt | 84 +- test/surface/test_concave_hull.cpp | 14 +- test/surface/test_convex_hull.cpp | 94 +- test/surface/test_ear_clipping.cpp | 50 +- test/surface/test_gp3.cpp | 2 +- test/surface/test_moving_least_squares.cpp | 78 +- test/surface/test_organized_fast_mesh.cpp | 10 +- test/surface/test_poisson.cpp | 2 +- ...est_recognition_ransac_based_ORROctree.cpp | 14 +- test/visualization/CMakeLists.txt | 18 +- test/visualization/test_visualization.cpp | 12 +- tools/CMakeLists.txt | 570 +- tools/add_gaussian_noise.cpp | 22 +- tools/boost.h | 12 +- tools/cluster_extraction.cpp | 4 +- tools/compute_cloud_error.cpp | 59 +- tools/compute_hausdorff.cpp | 12 +- tools/compute_hull.cpp | 5 +- tools/concatenate_points_pcd.cpp | 6 +- tools/crf_segmentation.cpp | 8 +- tools/crop_to_hull.cpp | 6 +- .../tools => tools}/davidsdk_viewer.cpp | 13 +- .../tools => tools}/depth_sense_viewer.cpp | 32 +- tools/elch.cpp | 24 +- .../tools => tools}/ensenso_viewer.cpp | 16 +- tools/fast_bilateral_filter.cpp | 10 +- tools/generate.cpp | 10 +- tools/gp3_surface.cpp | 6 +- tools/grid_min.cpp | 20 +- .../tools => tools}/hdl_viewer_simple.cpp | 43 +- tools/icp.cpp | 18 +- tools/icp2d.cpp | 24 +- .../tools => tools}/image_grabber_saver.cpp | 16 +- .../tools => tools}/image_grabber_viewer.cpp | 34 +- .../tools => tools}/image_viewer.cpp | 4 - tools/linemod_detection.cpp | 9 +- tools/local_max.cpp | 20 +- tools/lum.cpp | 26 +- tools/marching_cubes_reconstruction.cpp | 4 +- tools/match_linemod_template.cpp | 10 +- tools/mesh2pcd.cpp | 21 +- tools/mesh_sampling.cpp | 49 +- tools/mls_smoothing.cpp | 6 +- tools/morph.cpp | 22 +- tools/ndt2d.cpp | 42 +- tools/ndt3d.cpp | 20 +- tools/normal_estimation.cpp | 10 +- tools/obj2pcd.cpp | 4 - tools/obj2ply.cpp | 1 - tools/obj2vtk.cpp | 4 - tools/obj_rec_ransac_accepted_hypotheses.cpp | 52 +- tools/obj_rec_ransac_hash_table.cpp | 23 +- tools/obj_rec_ransac_model_opps.cpp | 28 +- tools/obj_rec_ransac_orr_octree.cpp | 38 +- .../obj_rec_ransac_orr_octree_zprojection.cpp | 38 +- tools/obj_rec_ransac_result.cpp | 50 +- tools/obj_rec_ransac_scene_opps.cpp | 26 +- tools/octree_viewer.cpp | 29 +- tools/oni2pcd.cpp | 6 +- .../tools => tools}/oni_viewer_simple.cpp | 29 +- .../tools => tools}/openni2_viewer.cpp | 92 +- .../tools => tools}/openni_image.cpp | 200 +- tools/openni_save_image.cpp | 108 +- .../tools => tools}/openni_viewer.cpp | 84 +- .../tools => tools}/openni_viewer_simple.cpp | 123 +- tools/outlier_removal.cpp | 2 +- tools/passthrough_filter.cpp | 18 +- tools/pcd2png.cpp | 2 - tools/pcd_change_viewpoint.cpp | 1 - .../tools => tools}/pcd_grabber_viewer.cpp | 44 +- {visualization/tools => tools}/pcd_viewer.cpp | 103 +- tools/pcl_video.cpp | 9 +- tools/pclzf2pcd.cpp | 2 +- tools/plane_projection.cpp | 3 +- tools/ply2pcd.cpp | 2 +- tools/ply2vtk.cpp | 4 - tools/png2pcd.cpp | 134 +- tools/progressive_morphological_filter.cpp | 20 +- tools/radius_filter.cpp | 14 +- .../tools => tools}/real_sense_viewer.cpp | 33 +- tools/sac_segmentation_plane.cpp | 22 +- tools/spin_estimation.cpp | 2 +- tools/tiff2pcd.cpp | 51 +- .../tools => tools}/timed_trigger_test.cpp | 17 +- tools/train_linemod_template.cpp | 26 +- tools/train_unary_classifier.cpp | 14 +- tools/transform_from_viewpoint.cpp | 4 +- tools/transform_point_cloud.cpp | 20 +- tools/unary_classifier_segment.cpp | 10 +- tools/uniform_sampling.cpp | 48 +- tools/vfh_estimation.cpp | 2 +- tools/virtual_scanner.cpp | 55 +- {visualization/tools => tools}/vlp_viewer.cpp | 31 +- tools/voxel_grid_occlusion_estimation.cpp | 36 +- tools/vtk2pcd.cpp | 4 - tools/vtk2ply.cpp | 4 - tools/xyz2pcd.cpp | 11 +- tracking/CMakeLists.txt | 96 +- ...pprox_nearest_pair_point_cloud_coherence.h | 18 +- tracking/include/pcl/tracking/boost.h | 11 +- tracking/include/pcl/tracking/coherence.h | 27 +- .../include/pcl/tracking/distance_coherence.h | 16 +- .../pcl/tracking/hsv_color_coherence.h | 11 +- ...rox_nearest_pair_point_cloud_coherence.hpp | 6 +- .../include/pcl/tracking/impl/coherence.hpp | 6 +- .../pcl/tracking/impl/hsv_color_coherence.hpp | 10 +- .../impl/kld_adaptive_particle_filter.hpp | 18 +- .../nearest_pair_point_cloud_coherence.hpp | 6 +- .../pcl/tracking/impl/normal_coherence.hpp | 26 +- .../pcl/tracking/impl/particle_filter.hpp | 57 +- .../pcl/tracking/impl/pyramidal_klt.hpp | 41 +- .../include/pcl/tracking/impl/tracker.hpp | 1 - .../include/pcl/tracking/impl/tracking.hpp | 14 +- .../tracking/kld_adaptive_particle_filter.h | 57 +- .../kld_adaptive_particle_filter_omp.h | 36 +- .../nearest_pair_point_cloud_coherence.h | 31 +- .../include/pcl/tracking/normal_coherence.h | 7 +- .../include/pcl/tracking/particle_filter.h | 56 +- .../pcl/tracking/particle_filter_omp.h | 33 +- tracking/include/pcl/tracking/pyramidal_klt.h | 35 +- tracking/include/pcl/tracking/tracker.h | 34 +- tracking/include/pcl/tracking/tracking.h | 5 +- tracking/src/tracking.cpp | 13 +- visualization/CMakeLists.txt | 341 +- .../pcl/visualization/area_picking_event.h | 5 +- .../include/pcl/visualization/boost.h | 11 +- .../include/pcl/visualization/cloud_viewer.h | 51 +- .../pcl/visualization/common/actor_map.h | 41 +- .../include/pcl/visualization/common/common.h | 21 +- .../visualization/common/float_image_utils.h | 9 +- .../pcl/visualization/common/impl/common.hpp | 2 +- .../pcl/visualization/common/impl/shapes.hpp | 16 +- .../include/pcl/visualization/common/io.h | 9 +- .../common/ren_win_interact_map.h | 13 +- .../include/pcl/visualization/common/shapes.h | 6 +- .../include/pcl/visualization/eigen.h | 5 +- .../pcl/visualization/histogram_visualizer.h | 37 +- .../include/pcl/visualization/image_viewer.h | 99 +- .../impl/histogram_visualizer.hpp | 11 +- .../pcl/visualization/impl/image_viewer.hpp | 68 +- .../pcl/visualization/impl/pcl_visualizer.hpp | 176 +- .../impl/point_cloud_color_handlers.hpp | 179 +- .../impl/point_cloud_geometry_handlers.hpp | 14 +- .../impl/registration_visualizer.hpp | 18 +- .../include/pcl/visualization/interactor.h | 107 - .../pcl/visualization/interactor_style.h | 101 +- .../pcl/visualization/keyboard_event.h | 6 +- .../include/pcl/visualization/mouse_event.h | 14 +- .../include/pcl/visualization/pcl_painter2D.h | 34 +- .../include/pcl/visualization/pcl_plotter.h | 30 +- .../pcl/visualization/pcl_visualizer.h | 106 +- .../point_cloud_color_handlers.h | 373 +- .../point_cloud_geometry_handlers.h | 91 +- .../pcl/visualization/point_cloud_handlers.h | 6 +- .../pcl/visualization/point_picking_event.h | 12 +- .../visualization/range_image_visualizer.h | 8 +- .../visualization/registration_visualizer.h | 35 +- .../visualization/simple_buffer_visualizer.h | 9 +- visualization/include/pcl/visualization/vtk.h | 36 +- .../pcl/visualization/vtk/pcl_context_item.h | 29 +- .../vtk/pcl_image_canvas_source_2d.h | 6 +- .../vtk/vtkRenderWindowInteractorFix.h | 7 +- .../vtk/vtkRenderWindowInteractorFix.mm | 177 - .../visualization/vtk/vtkVertexBufferObject.h | 9 +- .../vtk/vtkVertexBufferObjectMapper.h | 15 +- .../include/pcl/visualization/window.h | 44 +- visualization/src/cloud_viewer.cpp | 83 +- visualization/src/common/common.cpp | 147 +- .../src/common/float_image_utils.cpp | 28 +- visualization/src/common/io.cpp | 30 +- .../src/common/ren_win_interact_map.cpp | 3 - visualization/src/histogram_visualizer.cpp | 161 +- visualization/src/image_viewer.cpp | 265 +- visualization/src/interactor.cpp | 140 - visualization/src/interactor_style.cpp | 193 +- visualization/src/pcl_painter2D.cpp | 10 +- visualization/src/pcl_plotter.cpp | 44 +- visualization/src/pcl_visualizer.cpp | 550 +- visualization/src/point_cloud_handlers.cpp | 179 +- visualization/src/point_picking_event.cpp | 6 +- visualization/src/range_image_visualizer.cpp | 13 +- visualization/src/vtk/pcl_context_item.cpp | 4 +- .../src/vtk/vtkVertexBufferObject.cxx | 20 +- .../src/vtk/vtkVertexBufferObjectMapper.cxx | 28 +- visualization/src/window.cpp | 48 +- visualization/test/test.cpp | 4 +- visualization/test/test_geometry.cpp | 1 - visualization/test/test_shapes.cpp | 2 +- visualization/test/test_shapes_multiport.cpp | 2 +- visualization/tools/CMakeLists.txt | 64 - 2319 files changed, 58901 insertions(+), 71694 deletions(-) delete mode 100644 .azure-pipelines.yml create mode 100644 .ci/azure-pipelines/build-macos.yml create mode 100644 .ci/azure-pipelines/build-ubuntu-16-04.yaml create mode 100644 .ci/azure-pipelines/build-ubuntu-19-10.yaml create mode 100644 .ci/azure-pipelines/build-windows.yml create mode 100644 .ci/azure-pipelines/documentation.yml create mode 100644 .ci/azure-pipelines/formatting.yml create mode 100644 .ci/azure-pipelines/tutorials.yml create mode 100755 .ci/scripts/build_tutorials.sh create mode 100644 .clang-format create mode 100644 .dev/docker/doc/Dockerfile create mode 100644 .dev/docker/env/Dockerfile create mode 100644 .dev/docker/fmt/Dockerfile create mode 100755 .dev/format.sh rename apps/3d_rec_framework/{tools/apps/src => src/tools}/global_classification.cpp (73%) rename apps/3d_rec_framework/{tools/apps/src => src/tools}/local_recognition_mian_dataset.cpp (67%) delete mode 100644 apps/3d_rec_framework/tools/CMakeLists.txt delete mode 100644 apps/3d_rec_framework/tools/apps/CMakeLists.txt delete mode 100644 apps/cloud_composer/include/pcl/apps/cloud_composer/qt.h delete mode 100644 apps/modeler/include/pcl/apps/modeler/qt.h delete mode 100755 apps/modeler/tools/CMakeLists.txt delete mode 100644 apps/optronic_viewer/CMakeLists.txt delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h delete mode 100644 apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h delete mode 100644 apps/optronic_viewer/src/cloud_filter.cpp delete mode 100644 apps/optronic_viewer/src/filter_window.cpp delete mode 100644 apps/optronic_viewer/src/main.cpp delete mode 100644 apps/optronic_viewer/src/main_window.cpp delete mode 100644 apps/optronic_viewer/src/openni_grabber.cpp delete mode 100644 cmake/CMakeParseArguments.cmake create mode 100644 cmake/Modules/FindClangFormat.cmake delete mode 100644 cmake/Modules/FindFZAPI.cmake delete mode 100644 cmake/Modules/FindG2O.cmake delete mode 100644 cmake/Modules/FindGLEW.cmake delete mode 100644 cmake/Modules/FindGTSAM.cmake rename cmake/Modules/{FindGtest.cmake => FindGTestSource.cmake} (86%) delete mode 100644 cmake/Modules/FindQVTK.cmake create mode 100644 cmake/Modules/FindRSSDK2.cmake delete mode 100644 cmake/Modules/FindSuiteSparse.cmake create mode 100644 cmake/Modules/UseCompilerCache.cmake create mode 100644 cmake/clang-format.cmake delete mode 100644 cmake/pcl_find_python.cmake delete mode 100644 cmake/pcl_find_qt5.cmake create mode 100644 cmake/version.rc.in rename test/common/boost.h => common/include/pcl/make_shared.h (56%) create mode 100644 common/src/PCLPointCloud2.cpp delete mode 100644 doc/tutorials/content/images/windows/pcl_solution_without_projects_folder.png delete mode 100644 doc/tutorials/content/sources/vfh_recognition/FindFLANN.cmake delete mode 100644 gpu/utils/include/pcl/gpu/utils/device/limits.hpp create mode 100644 io/include/pcl/io/real_sense_2_grabber.h delete mode 100644 io/src/fotonic_grabber.cpp create mode 100644 io/src/real_sense_2_grabber.cpp mode change 100755 => 100644 ml/include/pcl/ml/impl/svm/svm_wrapper.hpp mode change 100755 => 100644 ml/include/pcl/ml/svm.h mode change 100755 => 100644 ml/include/pcl/ml/svm_wrapper.h mode change 100755 => 100644 ml/src/svm.cpp mode change 100755 => 100644 ml/src/svm_wrapper.cpp create mode 100644 registration/include/pcl/registration/impl/transformation_estimation_symmetric_point_to_plane_lls.hpp create mode 100644 registration/include/pcl/registration/transformation_estimation_symmetric_point_to_plane_lls.h delete mode 100644 surface/include/pcl/surface/3rdparty/poisson4/hash.h create mode 100644 surface/include/pcl/surface/3rdparty/poisson4/poisson_exceptions.h create mode 100644 test/common/test_polygon_mesh.cpp create mode 100644 test/common/test_type_traits.cpp create mode 100644 test/filters/test_uniform_sampling.cpp create mode 100644 test/registration/test_ndt.cpp create mode 100644 test/registration/test_sac_ia.cpp rename {visualization/tools => tools}/davidsdk_viewer.cpp (88%) rename {visualization/tools => tools}/depth_sense_viewer.cpp (94%) rename {visualization/tools => tools}/ensenso_viewer.cpp (85%) rename {visualization/tools => tools}/hdl_viewer_simple.cpp (85%) rename {visualization/tools => tools}/image_grabber_saver.cpp (90%) rename {visualization/tools => tools}/image_grabber_viewer.cpp (91%) rename {visualization/tools => tools}/image_viewer.cpp (96%) rename {visualization/tools => tools}/oni_viewer_simple.cpp (88%) rename {visualization/tools => tools}/openni2_viewer.cpp (76%) rename {visualization/tools => tools}/openni_image.cpp (76%) rename {visualization/tools => tools}/openni_viewer.cpp (79%) rename {visualization/tools => tools}/openni_viewer_simple.cpp (70%) rename {visualization/tools => tools}/pcd_grabber_viewer.cpp (86%) rename {visualization/tools => tools}/pcd_viewer.cpp (90%) rename {visualization/tools => tools}/real_sense_viewer.cpp (95%) rename {visualization/tools => tools}/timed_trigger_test.cpp (58%) rename {visualization/tools => tools}/vlp_viewer.cpp (90%) delete mode 100644 visualization/include/pcl/visualization/interactor.h delete mode 100644 visualization/src/interactor.cpp delete mode 100644 visualization/tools/CMakeLists.txt diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml deleted file mode 100644 index 815774ab..00000000 --- a/.azure-pipelines.yml +++ /dev/null @@ -1,183 +0,0 @@ -resources: - containers: - - container: env1604 - image: pointcloudlibrary/env:16.04 - - container: doc - image: pointcloudlibrary/doc - -jobs: - - job: ubuntu1604 - displayName: Ubuntu 16.04 Build - timeoutInMinutes: 0 - pool: - vmImage: 'Ubuntu 16.04' - container: env1604 - variables: - BUILD_DIR: '$(Agent.BuildDirectory)/build' - CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2' - steps: - - script: | - mkdir $BUILD_DIR && cd $BUILD_DIR - cmake $(Build.SourcesDirectory) \ - -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ - -DPCL_ONLY_CORE_POINT_TYPES=ON \ - -DPCL_QT_VERSION=5 \ - -DBUILD_simulation=ON \ - -DBUILD_global_tests=ON \ - -DBUILD_examples=ON \ - -DBUILD_tools=ON \ - -DBUILD_apps=ON \ - -DBUILD_apps_3d_rec_framework=ON \ - -DBUILD_apps_cloud_composer=ON \ - -DBUILD_apps_in_hand_scanner=ON \ - -DBUILD_apps_modeler=ON \ - -DBUILD_apps_point_cloud_editor=ON - displayName: 'CMake Configuration' - - script: | - cd $BUILD_DIR - # Compiling some of the test targets with -j2 option leads to pipeline failures - # (presumably out of memory error). Thus we make them separately in a single - # thread mode. Their corresponding modules are built before with the -j2 mode - # to make the process faster. - cmake --build . -- -j2 pcl_filters pcl_registration - cmake --build . -- test_filters test_registration test_registration_api - cmake --build . -- -j2 - displayName: 'Build Library' - - script: cd $BUILD_DIR && cmake --build . -- tests - displayName: 'Run Unit Tests' - - job: osx - displayName: macOS High Sierra - timeoutInMinutes: 0 - pool: - vmImage: 'macOS-10.13' - variables: - BUILD_DIR: '$(Agent.BuildDirectory)/build' - GOOGLE_TEST_DIR: '$(Agent.WorkFolder)/googletest' - CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2' - steps: - - script: | - brew install pkg-config qt5 libpcap brewsci/science/openni - brew install vtk --with-qt --without-python@2 - brew install --only-dependencies pcl - git clone https://github.com/abseil/googletest.git $GOOGLE_TEST_DIR # the official endpoint changed to abseil/googletest - cd $GOOGLE_TEST_DIR && git checkout release-1.8.1 - displayName: 'Install Dependencies' - - script: | - mkdir $BUILD_DIR && cd $BUILD_DIR - cmake $(Build.SourcesDirectory) \ - -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ - -DGTEST_SRC_DIR="$GOOGLE_TEST_DIR/googletest" \ - -DGTEST_INCLUDE_DIR="$GOOGLE_TEST_DIR/googletest/include" \ - -DQt5Core_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Core \ - -DQt5Gui_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Gui \ - -DQt5Widgets_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Widgets \ - -DQt5Concurrent_DIR=/usr/local/opt/qt5/lib/cmake/Qt5Concurrent \ - -DQt5OpenGL_DIR=/usr/local/opt/qt5/lib/cmake/Qt5OpenGL \ - -DPCL_ONLY_CORE_POINT_TYPES=ON \ - -DPCL_QT_VERSION=5 \ - -DBUILD_simulation=ON \ - -DBUILD_global_tests=ON \ - -DBUILD_examples=ON \ - -DBUILD_tools=ON \ - -DBUILD_apps=ON \ - -DBUILD_apps_3d_rec_framework=ON \ - -DBUILD_apps_cloud_composer=ON \ - -DBUILD_apps_in_hand_scanner=ON \ - -DBUILD_apps_modeler=ON \ - -DBUILD_apps_point_cloud_editor=ON - displayName: 'CMake Configuration' - - script: | - cd $BUILD_DIR - # Compiling some of the test targets with -j2 option leads to pipeline failures - # (presumably out of memory error). Thus we make them separately in a single - # thread mode. Their corresponding modules are built before with the -j2 mode - # to make the process faster. - cmake --build . -- -j2 pcl_filters pcl_registration - cmake --build . -- test_filters test_registration test_registration_api - cmake --build . -- -j2 - displayName: 'Build Library' - - script: cd $BUILD_DIR && cmake --build . -- tests - displayName: 'Run Unit Tests' - - job: documentation - displayName: Generate Documentation - pool: - vmImage: 'Ubuntu 16.04' - container: doc - variables: - BUILD_DIR: '$(Agent.BuildDirectory)/build' - DOC_DIR: '$(Agent.BuildDirectory)/documentation' - steps: - - task: InstallSSHKey@0 - inputs: - hostName: github.com - sshPublicKey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBh5Yrau/gguTfoNALxhVX77Pgz6y6UWoJRERMKR68ee documentation@pointclouds.org - sshKeySecureFile: id_ed25519 - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.6' - addToPath: true - - script: | - mkdir $BUILD_DIR && cd $BUILD_DIR - cmake $(Build.SourcesDirectory) \ - -DDOXYGEN_USE_SHORT_NAMES=OFF \ - -DSPHINX_HTML_FILE_SUFFIX=php \ - -DWITH_DOCS=ON \ - -DWITH_TUTORIALS=ON - displayName: 'CMake Configuration' - - script: cd $BUILD_DIR && make doc tutorials advanced - displayName: 'Build Documentation' - - script: | - git config --global user.email "documentation@pointclouds.org" - git config --global user.name "PointCloudLibrary (via Azure Pipelines)" - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - git clone git@github.com:PointCloudLibrary/documentation.git $DOC_DIR - cd $DOC_DIR - cp -r $BUILD_DIR/doc/tutorials/html/* tutorials - cp -r $BUILD_DIR/doc/advanced/html/* advanced - cp -r $BUILD_DIR/doc/doxygen/html/* . - git add --all - git commit --amend --reset-author -m 'Documentation for commit $(Build.SourceVersion)' -q - git push --force - displayName: 'Push Generated Documentation To GitHub' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/master') - - job: vs2017 - displayName: Windows VS2017 Build - timeoutInMinutes: 0 - pool: - vmImage: 'vs2017-win2016' - strategy: - matrix: - x86: - PLATFORM: 'x86' - ARCHITECTURE: 'x86' - GENERATOR: 'Visual Studio 15 2017' - x64: - PLATFORM: 'x64' - ARCHITECTURE: 'x86_amd64' - GENERATOR: 'Visual Studio 15 2017 Win64' - variables: - BUILD_DIR: '$(Agent.WorkFolder)\build' - VCPKG_DIR: '$(Agent.WorkFolder)\vcpkg' - VCVARSALL: '%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat' - CONFIGURATION: 'Release' - steps: - - script: | - git clone https://github.com/microsoft/vcpkg --depth 1 %VCPKG_DIR% - echo.set(VCPKG_BUILD_TYPE release)>> %VCPKG_DIR%\triplets\%PLATFORM%-windows.cmake - %VCPKG_DIR%\bootstrap-vcpkg.bat - %VCPKG_DIR%\vcpkg.exe version - displayName: Bootstrap vcpkg - - script: | - %VCPKG_DIR%\vcpkg.exe install boost-system boost-filesystem boost-thread boost-date-time boost-iostreams boost-chrono boost-asio boost-dynamic-bitset boost-foreach boost-graph boost-interprocess boost-multi-array boost-ptr-container boost-random boost-signals2 eigen3 flann gtest qhull --triplet %PLATFORM%-windows - %VCPKG_DIR%\vcpkg.exe list - displayName: Install Dependencies - - script: | - call "%VCVARSALL%" %ARCHITECTURE% - set PATH=%VCPKG_DIR%\installed\%PLATFORM%-windows\bin;%PATH% - mkdir %BUILD_DIR% && cd %BUILD_DIR% - cmake $(Build.SourcesDirectory) -G"%GENERATOR%" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_DIR%\scripts\buildsystems\vcpkg.cmake -DVCPKG_APPLOCAL_DEPS=ON -DPCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32=ON -DPCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32=ON -DPCL_BUILD_WITH_QHULL_DYNAMIC_LINKING_WIN32=ON -DBUILD_global_tests=ON -DBUILD_tools=OFF -DBUILD_surface_on_nurbs=ON - displayName: 'CMake Configuration' - - script: cd %BUILD_DIR% && cmake --build . --config %CONFIGURATION% - displayName: 'Build Library' - - script: cd %BUILD_DIR% && ctest -C %CONFIGURATION% -V - displayName: 'Run Unit Tests' diff --git a/.ci/azure-pipelines/build-macos.yml b/.ci/azure-pipelines/build-macos.yml new file mode 100644 index 00000000..94a3ec4a --- /dev/null +++ b/.ci/azure-pipelines/build-macos.yml @@ -0,0 +1,57 @@ +jobs: + - job: osx + displayName: macOS High Sierra + timeoutInMinutes: 0 + pool: + vmImage: 'macOS-10.13' + variables: + BUILD_DIR: '$(Agent.WorkFolder)/build' + GOOGLE_TEST_DIR: '$(Agent.WorkFolder)/googletest' + CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2' + steps: + - script: | + brew install pkg-config qt5 libpcap brewsci/science/openni + brew install vtk --with-qt --without-python@2 + brew install --only-dependencies pcl + git clone https://github.com/abseil/googletest.git $GOOGLE_TEST_DIR # the official endpoint changed to abseil/googletest + cd $GOOGLE_TEST_DIR && git checkout release-1.8.1 + displayName: 'Install Dependencies' + - script: | + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake $(Build.SourcesDirectory) \ + -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ + -DGTEST_SRC_DIR="$GOOGLE_TEST_DIR/googletest" \ + -DGTEST_INCLUDE_DIR="$GOOGLE_TEST_DIR/googletest/include" \ + -DQt5_DIR=/usr/local/opt/qt5/lib/cmake/Qt5 \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DBUILD_simulation=ON \ + -DBUILD_surface=OFF \ + -DBUILD_global_tests=ON \ + -DBUILD_examples=ON \ + -DBUILD_tools=ON \ + -DBUILD_apps=ON \ + -DBUILD_apps_3d_rec_framework=ON \ + -DBUILD_apps_cloud_composer=ON \ + -DBUILD_apps_in_hand_scanner=ON \ + -DBUILD_apps_modeler=ON \ + -DBUILD_apps_point_cloud_editor=ON + displayName: 'CMake Configuration' + - script: | + cd $BUILD_DIR + # Compiling some of the test targets with -j2 option leads to pipeline failures + # (presumably out of memory error). Thus we make them separately in a single + # thread mode. Their corresponding modules are built before with the -j2 mode + # to make the process faster. + cmake --build . -- -j2 pcl_filters pcl_registration + cmake --build . -- test_filters test_registration test_registration_api + cmake --build . -- -j2 + displayName: 'Build Library' + - script: cd $BUILD_DIR/test && ctest -V -T Test + displayName: 'Run Unit Tests' + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'CTest' + testResultsFiles: '**/Test*.xml' + searchFolder: '$(Agent.WorkFolder)/build' + condition: succeededOrFailed() + diff --git a/.ci/azure-pipelines/build-ubuntu-16-04.yaml b/.ci/azure-pipelines/build-ubuntu-16-04.yaml new file mode 100644 index 00000000..74d76fcc --- /dev/null +++ b/.ci/azure-pipelines/build-ubuntu-16-04.yaml @@ -0,0 +1,52 @@ +resources: + containers: + - container: env1604 + image: pointcloudlibrary/env:16.04 + +jobs: + - job: ubuntu1604 + displayName: Ubuntu 16.04 + timeoutInMinutes: 0 + pool: + vmImage: 'Ubuntu 16.04' + container: env1604 + variables: + BUILD_DIR: '$(Agent.BuildDirectory)/build' + steps: + - script: | + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake $(Build.SourcesDirectory) \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_WARNINGS_ARE_ERRORS=ON \ + -DBUILD_simulation=ON \ + -DBUILD_surface_on_nurbs=ON \ + -DBUILD_global_tests=ON \ + -DBUILD_examples=ON \ + -DBUILD_tools=ON \ + -DBUILD_apps=ON \ + -DBUILD_apps_3d_rec_framework=ON \ + -DBUILD_apps_cloud_composer=ON \ + -DBUILD_apps_in_hand_scanner=ON \ + -DBUILD_apps_modeler=ON \ + -DBUILD_apps_point_cloud_editor=ON + displayName: 'CMake Configuration' + - script: | + cd $BUILD_DIR + # Compiling some of the test targets with -j2 option leads to pipeline failures + # (presumably out of memory error). Thus we make them separately in a single + # thread mode. Their corresponding modules are built before with the -j2 mode + # to make the process faster. + cmake --build . -- -j2 pcl_filters pcl_registration + cmake --build . -- test_filters test_registration test_registration_api + cmake --build . -- -j2 + displayName: 'Build Library' + - script: | + cd $BUILD_DIR/test + ctest -V -T Test + displayName: 'Run Unit Tests' + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'CTest' + testResultsFiles: '**/Test*.xml' + searchFolder: '$(Agent.BuildDirectory)/build' + condition: succeededOrFailed() diff --git a/.ci/azure-pipelines/build-ubuntu-19-10.yaml b/.ci/azure-pipelines/build-ubuntu-19-10.yaml new file mode 100644 index 00000000..bb1b70f3 --- /dev/null +++ b/.ci/azure-pipelines/build-ubuntu-19-10.yaml @@ -0,0 +1,53 @@ +resources: + containers: + - container: env1910 + image: pointcloudlibrary/env:19.10 + +jobs: + - job: ubuntu1910 + displayName: Ubuntu 19.10 + timeoutInMinutes: 0 + pool: + vmImage: 'Ubuntu 16.04' + container: env1910 + variables: + BUILD_DIR: '$(Agent.BuildDirectory)/build' + CMAKE_CXX_FLAGS: '-Wall -Wextra -O2' + steps: + - script: | + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake $(Build.SourcesDirectory) \ + -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DBUILD_simulation=ON \ + -DBUILD_surface_on_nurbs=ON \ + -DBUILD_global_tests=ON \ + -DBUILD_examples=ON \ + -DBUILD_tools=ON \ + -DBUILD_apps=ON \ + -DBUILD_apps_3d_rec_framework=ON \ + -DBUILD_apps_cloud_composer=ON \ + -DBUILD_apps_in_hand_scanner=ON \ + -DBUILD_apps_modeler=ON \ + -DBUILD_apps_point_cloud_editor=ON + displayName: 'CMake Configuration' + - script: | + cd $BUILD_DIR + # Compiling some of the test targets with -j2 option leads to pipeline failures + # (presumably out of memory error). Thus we make them separately in a single + # thread mode. Their corresponding modules are built before with the -j2 mode + # to make the process faster. + cmake --build . -- -j2 pcl_filters pcl_registration + cmake --build . -- test_filters test_registration test_registration_api + cmake --build . -- -j2 + displayName: 'Build Library' + - script: | + cd $BUILD_DIR/test + ctest -V -T Test + displayName: 'Run Unit Tests' + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'CTest' + testResultsFiles: '**/Test*.xml' + searchFolder: '$(Agent.BuildDirectory)/build' + condition: succeededOrFailed() diff --git a/.ci/azure-pipelines/build-windows.yml b/.ci/azure-pipelines/build-windows.yml new file mode 100644 index 00000000..b55b1214 --- /dev/null +++ b/.ci/azure-pipelines/build-windows.yml @@ -0,0 +1,48 @@ +jobs: + - job: vs2017 + displayName: Windows VS2017 Build + timeoutInMinutes: 0 + pool: + vmImage: 'vs2017-win2016' + strategy: + matrix: + x86: + PLATFORM: 'x86' + ARCHITECTURE: 'x86' + GENERATOR: 'Visual Studio 15 2017' + x64: + PLATFORM: 'x64' + ARCHITECTURE: 'x86_amd64' + GENERATOR: 'Visual Studio 15 2017 Win64' + variables: + BUILD_DIR: '$(Agent.WorkFolder)\build' + CONFIGURATION: 'Release' + VCPKG_ROOT: 'C:\vcpkg' + steps: + - script: set + displayName: 'Print Environment Variables' + - script: | + echo ##vso[task.prependpath]%BOOST_ROOT%\lib + displayName: 'Update System PATH' + - script: | + vcpkg.exe install eigen3 flann gtest qhull --triplet %PLATFORM%-windows && vcpkg.exe list + displayName: 'Install c++ dependencies via vcpkg' + - script: | + rmdir %VCPKG_ROOT%\downloads /S /Q + rmdir %VCPKG_ROOT%\packages /S /Q + displayName: 'Free Up Space' + - script: | + mkdir %BUILD_DIR% && cd %BUILD_DIR% + cmake $(Build.SourcesDirectory) -G"%GENERATOR%" -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake -DVCPKG_APPLOCAL_DEPS=ON -DPCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32=ON -DPCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32=ON -DPCL_BUILD_WITH_QHULL_DYNAMIC_LINKING_WIN32=ON -DBUILD_global_tests=ON -DBUILD_tools=OFF -DBUILD_surface_on_nurbs=ON + displayName: 'CMake Configuration' + - script: cd %BUILD_DIR% && cmake --build . --config %CONFIGURATION% + displayName: 'Build Library' + - script: cd %BUILD_DIR%/test && ctest -C %CONFIGURATION% -V -T Test + displayName: 'Run Unit Tests' + - task: PublishTestResults@2 + inputs: + testResultsFormat: 'CTest' + testResultsFiles: '**/Test*.xml' + searchFolder: '$(Agent.WorkFolder)\build' + condition: succeededOrFailed() + diff --git a/.ci/azure-pipelines/documentation.yml b/.ci/azure-pipelines/documentation.yml new file mode 100644 index 00000000..3ec71b69 --- /dev/null +++ b/.ci/azure-pipelines/documentation.yml @@ -0,0 +1,50 @@ +resources: + containers: + - container: doc + image: pointcloudlibrary/doc + +jobs: + - job: documentation + displayName: Generate Documentation + pool: + vmImage: 'Ubuntu 16.04' + container: doc + variables: + BUILD_DIR: '$(Agent.BuildDirectory)/build' + DOC_DIR: '$(Agent.BuildDirectory)/documentation' + steps: + - task: InstallSSHKey@0 + inputs: + hostName: github.com + sshPublicKey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBh5Yrau/gguTfoNALxhVX77Pgz6y6UWoJRERMKR68ee documentation@pointclouds.org + sshKeySecureFile: id_ed25519 + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.6' + addToPath: true + - script: | + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake $(Build.SourcesDirectory) \ + -DDOXYGEN_USE_SHORT_NAMES=OFF \ + -DSPHINX_HTML_FILE_SUFFIX=php \ + -DWITH_DOCS=ON \ + -DWITH_TUTORIALS=ON + displayName: 'CMake Configuration' + - script: | + cd $BUILD_DIR + cmake --build . -- doc tutorials advanced + displayName: 'Build Documentation' + - script: | + git config --global user.email "documentation@pointclouds.org" + git config --global user.name "PointCloudLibrary (via Azure Pipelines)" + echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config + git clone git@github.com:PointCloudLibrary/documentation.git $DOC_DIR + cd $DOC_DIR + cp -r $BUILD_DIR/doc/tutorials/html/* tutorials + cp -r $BUILD_DIR/doc/advanced/html/* advanced + cp -r $BUILD_DIR/doc/doxygen/html/* . + git add --all + git commit --amend --reset-author -m 'Documentation for commit $(Build.SourceVersion)' -q + git push --force + displayName: 'Push Generated Documentation To GitHub' + condition: eq(variables['Build.SourceBranch'], 'refs/heads/master') diff --git a/.ci/azure-pipelines/formatting.yml b/.ci/azure-pipelines/formatting.yml new file mode 100644 index 00000000..1bff15b3 --- /dev/null +++ b/.ci/azure-pipelines/formatting.yml @@ -0,0 +1,31 @@ +resources: + containers: + - container: fmt + image: pointcloudlibrary/fmt + +jobs: + - job: formatting + displayName: Check code formatting + pool: + vmImage: 'Ubuntu 16.04' + container: fmt + steps: + - script: ./.dev/format.sh $(which clang-format-8) . + displayName: 'Run clang-format' + - script: git diff > formatting.patch + displayName: 'Compute diff' + - script: cat formatting.patch + displayName: 'Show diff' + - task: CopyFiles@2 + inputs: + sourceFolder: '$(Build.SourcesDirectory)' + contents: 'formatting.patch' + targetFolder: '$(Build.ArtifactStagingDirectory)' + displayName: 'Copy diff to staging directory' + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: formatting + displayName: 'Publish diff' + - script: "[ ! -s formatting.patch ]" + displayName: 'Set job exit status' diff --git a/.ci/azure-pipelines/tutorials.yml b/.ci/azure-pipelines/tutorials.yml new file mode 100644 index 00000000..afabea93 --- /dev/null +++ b/.ci/azure-pipelines/tutorials.yml @@ -0,0 +1,44 @@ +resources: + containers: + - container: env1604 + image: pointcloudlibrary/env:16.04 + +jobs: + - job: tutorials + displayName: Tutorials + timeoutInMinutes: 0 + pool: + vmImage: 'Ubuntu 16.04' + container: env1604 + variables: + BUILD_DIR: '$(Agent.BuildDirectory)/build' + INSTALL_DIR: '$(Agent.BuildDirectory)/install' + CMAKE_CXX_FLAGS: '-Wall -Wextra -Wabi -O2' + EXCLUDE_TUTORIALS: 'davidsdk,ensenso_cameras,gpu' + steps: + - script: | + mkdir $BUILD_DIR && cd $BUILD_DIR + cmake $(Build.SourcesDirectory) \ + -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" \ + -DPCL_ONLY_CORE_POINT_TYPES=ON \ + -DPCL_NO_PRECOMPILE=ON \ + -DBUILD_surface_on_nurbs=ON \ + -DBUILD_global_tests=OFF \ + -DBUILD_tools=OFF \ + -DBUILD_examples=OFF \ + -DBUILD_outofcore=OFF \ + -DBUILD_stereo=OFF \ + -DBUILD_simulation=OFF + displayName: 'CMake Configuration' + - script: | + cd $BUILD_DIR + cmake --build . -- -j2 + displayName: 'Build Library' + - script: | + cd $BUILD_DIR + cmake --build . -- install + displayName: 'Install PCL' + - script: | + $(Build.SourcesDirectory)/.ci/scripts/build_tutorials.sh -k -s -e $EXCLUDE_TUTORIALS $INSTALL_DIR/share/pcl-1.9 $(Build.SourcesDirectory) $BUILD_DIR/tutorials + displayName: 'Build Tutorials' diff --git a/.ci/scripts/build_tutorials.sh b/.ci/scripts/build_tutorials.sh new file mode 100755 index 00000000..169128ec --- /dev/null +++ b/.ci/scripts/build_tutorials.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +show_help() { +cat << EOF +Usage: ${0##*/} [OPTIONS] INSTALL_DIR SOURCE_DIR BUILD_DIR + +This script builds source code projects of PCL tutorials. + +Options: + + -h Dispaly this help and exit. + -k Keep going after a configuration/build error. + -s Print summary in the end. + -e NAMES Exclude tutorials from the build. + NAMES is a comma-separated list of tutorial names. + +Arguments: + + INSTALL_DIR Path to the directory where PCLConfig.cmake in installed. + SOURCE_DIR Path to the root of PCL repository. + BUILD_DIR Path to the directory where the tutorials should be built. +EOF +} + +while getopts "hkse:" option; do + case "${option}" in + h) show_help + exit 0 + ;; + k) KEEP_GOING=1 + ;; + s) SUMMARY=1 + ;; + e) EXCLUDE=${OPTARG} + ;; + *) show_help + exit 1 + ;; + esac +done + +shift $((OPTIND-1)) + +if [[ $# -ne 3 ]]; then + show_help + exit 1 +fi + +INSTALL_DIR=$1 +SOURCE_DIR=$2/doc/tutorials/content/sources +BUILD_DIR=$3 + +if [[ ! -f "$INSTALL_DIR/PCLConfig.cmake" ]]; then + echo "Invalid install directory" + exit 2 +fi + +if [[ ! -d "$SOURCE_DIR" ]]; then + echo "Invalid source directory" + exit 3 +fi + +mkdir -p "$BUILD_DIR" + +TUTORIALS=() + +for DIRECTORY in "$SOURCE_DIR"/*/ ; do + NAME=$(basename "$DIRECTORY") + if [[ "$EXCLUDE" == *$NAME* ]]; then + STATUS="excluded" + elif [[ -z ${SKIP+x} ]]; then + TUTORIAL_SOURCE_DIR=$(realpath "$DIRECTORY") + TUTORIAL_BUILD_DIR="$BUILD_DIR/$NAME" + mkdir -p "$TUTORIAL_BUILD_DIR" && cd "$TUTORIAL_BUILD_DIR" || exit + echo "Configuring tutorial: $NAME" + if ! cmake "$TUTORIAL_SOURCE_DIR" -DPCL_DIR="$INSTALL_DIR" -DCMAKE_CXX_FLAGS="-Werror"; then + STATUS="cmake error" + else + echo "Building tutorial: $NAME" + if ! cmake --build . -- -j2; then + STATUS="build error" + fi + fi + if [[ -n $STATUS ]]; then + FAILED=1 + if [[ $KEEP_GOING -ne 1 ]]; then + SKIP=1 + fi + fi + cd - || exit + else + STATUS="skipped" + fi + TUTORIALS+=("$NAME") + STATUSES+=("$STATUS") + unset STATUS +done + +if [[ $SUMMARY -eq 1 ]]; then + echo "" + echo "Tutorial build summary" + echo "----------------------" + echo "" + SUCCEEDED=0 + EXCLUDED=0 + for i in "${!TUTORIALS[@]}"; do + if [[ "${STATUSES[$i]}" == "" ]]; then + MARK="🗸" + SUCCEEDED=$((SUCCEEDED+1)) + elif [[ "${STATUSES[$i]}" == *error* ]]; then + MARK="𐄂" + else + MARK="-" + EXCLUDED=$((EXCLUDED+1)) + fi + printf "%-46s %s %s\\n" "${TUTORIALS[$i]}" "$MARK" "${STATUSES[$i]}" + done + echo "" + echo "Succeeded building $SUCCEEDED out of ${#TUTORIALS[@]} tutorials" + echo "Excluded or skipped $EXCLUDED tutorials" +fi + +exit $FAILED diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..86162372 --- /dev/null +++ b/.clang-format @@ -0,0 +1,23 @@ +--- +AlwaysBreakAfterReturnType: All +AlwaysBreakTemplateDeclarations: true +BinPackArguments: false +BinPackParameters: false +BraceWrapping: + AfterFunction: true + AfterClass: false + AfterStruct: false + BeforeElse: true + SplitEmptyFunction: false + SplitEmptyRecord: false + SplitEmptyNamespace: false +BreakBeforeBraces: Custom +BreakConstructorInitializers: BeforeComma +ColumnLimit: 88 +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 0 +Language: Cpp +PointerAlignment: Left +Standard: Cpp11 +TabWidth: 2 +UseTab: Never diff --git a/.dev/docker/doc/Dockerfile b/.dev/docker/doc/Dockerfile new file mode 100644 index 00000000..5d4f95e6 --- /dev/null +++ b/.dev/docker/doc/Dockerfile @@ -0,0 +1,13 @@ +FROM pointcloudlibrary/env:19.04 + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y \ + doxygen-latex \ + dvipng \ + git \ + python3-pip \ + && rm -rf /var/lib/apt/lists/* + +RUN pip3 install Jinja2==2.8.1 sphinx sphinxcontrib-doxylink diff --git a/.dev/docker/env/Dockerfile b/.dev/docker/env/Dockerfile new file mode 100644 index 00000000..c54c97cd --- /dev/null +++ b/.dev/docker/env/Dockerfile @@ -0,0 +1,42 @@ +ARG UBUNTU_DISTRO=16.04 +FROM ubuntu:${UBUNTU_DISTRO} + +ARG VTK_VERSION=6 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y \ + cmake \ + g++ \ + wget \ + libboost-date-time-dev \ + libboost-filesystem-dev \ + libboost-iostreams-dev \ + libeigen3-dev \ + libflann-dev \ + libglew-dev \ + libgtest-dev \ + libopenni-dev \ + libopenni2-dev \ + libproj-dev \ + libqhull-dev \ + libqt5opengl5-dev \ + libusb-1.0-0-dev \ + libvtk${VTK_VERSION}-dev \ + libvtk${VTK_VERSION}-qt-dev \ + qtbase5-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN wget -qO- https://github.com/IntelRealSense/librealsense/archive/v2.23.0.tar.gz | tar xz \ + && cd librealsense-2.23.0 \ + && mkdir build \ + && cd build \ + && cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_GRAPHICAL_EXAMPLES=OFF \ + && make -j2 \ + && make install \ + && cd ../.. \ + && rm -rf librealsense-2.23.0 + +RUN wget -qO ensenso.deb https://download.ensenso.com/s/ensensosdk/download?files=ensenso-sdk-2.2.160-x64.deb \ + && dpkg -i ensenso.deb \ + && rm ensenso.deb diff --git a/.dev/docker/fmt/Dockerfile b/.dev/docker/fmt/Dockerfile new file mode 100644 index 00000000..b3fc3d98 --- /dev/null +++ b/.dev/docker/fmt/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:19.04 + +ENV DEBIAN_FRONTEND=noninteractive +ARG CLANG_FORMAT_VERSION=8 + +RUN apt-get update \ + && apt-get install -y \ + clang-format-${CLANG_FORMAT_VERSION} \ + bash \ + git \ + && rm -rf /var/lib/apt/lists/* diff --git a/.dev/format.sh b/.dev/format.sh new file mode 100755 index 00000000..769a2b9c --- /dev/null +++ b/.dev/format.sh @@ -0,0 +1,34 @@ +#! /usr/bin/env sh + +# sample command line usage: $0 clang-format(version >= 6.0) $PCL_SOURCE_DIR +# $ sh ./.dev/format.sh `which clang-format` ./ +# $ sh format.sh `which clang-format` ../ +# $ sh ~/pcl/format.sh `which clang-format` ~/pcl +# $ sh /pcl/format.sh `which clang-format` /pcl + +format() { + # don't use a directory with whitespace + local whitelist="2d ml simulation stereo" + + local PCL_DIR="${2}" + local formatter="${1}" + + if [ ! -f "${formatter}" ]; then + echo "Could not find a clang-format. Please specify one as the first argument" + exit 166 + fi + + # check for self + if [ ! -f "${PCL_DIR}/.dev/format.sh" ]; then + echo "Please ensure that PCL_SOURCE_DIR is passed as the second argument" + exit 166 + fi + + for dir in ${whitelist}; do + path=${PCL_DIR}/${dir} + find ${path} -type f -iname *.[ch] -o -iname *.[ch]pp -o -iname *.[ch]xx \ + -iname *.cu | xargs -n1 ${formatter} -i -style=file + done +} + +format $@ diff --git a/.github/issue_template.md b/.github/issue_template.md index 9157557d..a07f5952 100644 --- a/.github/issue_template.md +++ b/.github/issue_template.md @@ -1,4 +1,4 @@ - + diff --git a/2d/CMakeLists.txt b/2d/CMakeLists.txt index 5affe826..8bd5411e 100644 --- a/2d/CMakeLists.txt +++ b/2d/CMakeLists.txt @@ -8,38 +8,39 @@ PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS vtk) PCL_ADD_DOC("${SUBSYS_NAME}") -if(build) - - set(srcs - src/convolution_2d.cpp - ) - - set(incs - "include/pcl/${SUBSYS_NAME}/convolution.h" - "include/pcl/${SUBSYS_NAME}/kernel.h" - "include/pcl/${SUBSYS_NAME}/edge.h" - "include/pcl/${SUBSYS_NAME}/morphology.h" - ) - - set(impl_incs - "include/pcl/${SUBSYS_NAME}/impl/convolution.hpp" - "include/pcl/${SUBSYS_NAME}/impl/edge.hpp" - "include/pcl/${SUBSYS_NAME}/impl/morphology.hpp" - ) - - if(${VTK_FOUND}) - set(VTK_USE_FILE "${VTK_USE_FILE}" CACHE INTERNAL "VTK_USE_FILE") - include("${VTK_USE_FILE}") - set(VTK_IO_TARGET_LINK_LIBRARIES vtkCommon vtkWidgets vtkIO vtkImaging) - endif(${VTK_FOUND}) - - include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include" ${VTK_INCLUDE_DIRECTORIES}) - - set(LIB_NAME "pcl_${SUBSYS_NAME}") - PCL_MAKE_PKGCONFIG_HEADER_ONLY("${LIB_NAME}" "${SUBSYS_NAME}" "${SUBSYS_DESC}" "${SUBSYS_DEPS}" "" "" "" "") - - #Install include files - PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}" ${incs}) - PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/impl" ${impl_incs}) - -endif(build) +if(NOT build) + return() +endif() + +set(srcs + src/convolution_2d.cpp +) + +set(incs + "include/pcl/${SUBSYS_NAME}/convolution.h" + "include/pcl/${SUBSYS_NAME}/kernel.h" + "include/pcl/${SUBSYS_NAME}/edge.h" + "include/pcl/${SUBSYS_NAME}/morphology.h" +) + +set(impl_incs + "include/pcl/${SUBSYS_NAME}/impl/convolution.hpp" + "include/pcl/${SUBSYS_NAME}/impl/kernel.hpp" + "include/pcl/${SUBSYS_NAME}/impl/edge.hpp" + "include/pcl/${SUBSYS_NAME}/impl/morphology.hpp" +) + +if(${VTK_FOUND}) + set(VTK_USE_FILE "${VTK_USE_FILE}" CACHE INTERNAL "VTK_USE_FILE") + include("${VTK_USE_FILE}") + set(VTK_IO_TARGET_LINK_LIBRARIES vtkCommon vtkWidgets vtkIO vtkImaging) +endif() + +include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") + +set(LIB_NAME "pcl_${SUBSYS_NAME}") +PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS} HEADER_ONLY) + +#Install include files +PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}" ${incs}) +PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/impl" ${impl_incs}) diff --git a/2d/include/pcl/2d/convolution.h b/2d/include/pcl/2d/convolution.h index 7938e2b0..3ee3c8e1 100644 --- a/2d/include/pcl/2d/convolution.h +++ b/2d/include/pcl/2d/convolution.h @@ -35,125 +35,118 @@ * */ -#ifndef PCL_2D_CONVOLUTION_H -#define PCL_2D_CONVOLUTION_H +#pragma once -#include #include +#include +#include #include -namespace pcl -{ +namespace pcl { + +/// Point cloud containing edge information. +struct EIGEN_ALIGN16 PointXYZIEdge { + PCL_ADD_POINT4D; // preferred way of adding a XYZ+padding + float magnitude; + float direction; + float magnitude_x; + float magnitude_y; + PCL_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned +}; // enforce SSE padding for correct memory alignment + +/// A 2D convolution class. +template +class Convolution : public Filter { +public: + using Filter::input_; + /** - * This typedef is used to represent a point cloud containing edge information + * Extra pixels are added to the input image so that convolution can be performed over + * the entire image. + * + * (kernel_height/2) rows are added before the first row and after the last row + * (kernel_width/2) columns are added before the first column and after the last + * column border options define what values are set for these extra rows and columns + * + * Assume that the three rows of right edge of the image looks like this: + * .. 3 2 1 + * .. 6 5 4 + * .. 9 8 7 + * + * BOUNDARY_OPTION_CLAMP : the extra pixels are set to the pixel value of the boundary + * pixel. This option makes it seem as if it were: + * .. 3 2 1| 1 1 1 .. + * .. 6 5 4| 4 4 4 .. + * .. 9 8 7| 7 7 7 .. + * + * BOUNDARY_OPTION_MIRROR : the input image is mirrored at the boundary. This option + * makes it seem as if it were: + * .. 3 2 1| 1 2 3 .. + * .. 6 5 4| 4 5 6 .. + * .. 9 8 7| 7 8 9 .. + * + * BOUNDARY_OPTION_ZERO_PADDING : the extra pixels are simply set to 0. This option + * makes it seem as if it were: + * .. 3 2 1| 0 0 0 .. + * .. 6 5 4| 0 0 0 .. + * .. 9 8 7| 0 0 0 .. + * + * Note that the input image is not actually extended in size. Instead, based on these + * options, the convolution is performed differently at the border pixels. */ - struct PointXYZIEdge - { - PCL_ADD_POINT4D; // preferred way of adding a XYZ+padding - float magnitude; - float direction; - float magnitude_x; - float magnitude_y; - EIGEN_MAKE_ALIGNED_OPERATOR_NEW // make sure our new allocators are aligned - } EIGEN_ALIGN16; // enforce SSE padding for correct memory alignment - - /** \brief A 2D convolution class. */ - template - class Convolution : public Filter - { - public: - using Filter::input_; - - /** - * Extra pixels are added to the input image so that convolution can be performed over the entire image. - * - * (kernel_height/2) rows are added before the first row and after the last row - * (kernel_width/2) columns are added before the first column and after the last column - * border options define what values are set for these extra rows and columns - * - * Assume that the three rows of right edge of the image looks like this: - * .. 3 2 1 - * .. 6 5 4 - * .. 9 8 7 - * - * BOUNDARY_OPTION_CLAMP : the extra pixels are set to the pixel value of the boundary pixel - * This option makes it seem as if it were: - * .. 3 2 1| 1 1 1 .. - * .. 6 5 4| 4 4 4 .. - * .. 9 8 7| 7 7 7 .. - * - * BOUNDARY_OPTION_MIRROR : the input image is mirrored at the boundary. - * This option makes it seem as if it were: - * .. 3 2 1| 1 2 3 .. - * .. 6 5 4| 4 5 6 .. - * .. 9 8 7| 7 8 9 .. - * - * BOUNDARY_OPTION_ZERO_PADDING : the extra pixels are simply set to 0 - * This option makes it seem as if it were: - * .. 3 2 1| 0 0 0 .. - * .. 6 5 4| 0 0 0 .. - * .. 9 8 7| 0 0 0 .. - * - * Note that the input image is not actually extended in size. Instead, based on these options, - * the convolution is performed differently at the border pixels. - */ - enum BOUNDARY_OPTIONS_ENUM - { - BOUNDARY_OPTION_CLAMP, - BOUNDARY_OPTION_MIRROR, - BOUNDARY_OPTION_ZERO_PADDING - }; + enum BOUNDARY_OPTIONS_ENUM { + BOUNDARY_OPTION_CLAMP, + BOUNDARY_OPTION_MIRROR, + BOUNDARY_OPTION_ZERO_PADDING + }; - Convolution () - { - boundary_options_ = BOUNDARY_OPTION_CLAMP; - } + Convolution() { boundary_options_ = BOUNDARY_OPTION_CLAMP; } - /** \brief Sets the kernel to be used for convolution - * \param[in] kernel convolution kernel passed by reference - */ - inline void - setKernel (const pcl::PointCloud &kernel) - { - kernel_ = kernel; - } + /** \brief Sets the kernel to be used for convolution + * \param[in] kernel convolution kernel passed by reference + */ + inline void + setKernel(const pcl::PointCloud& kernel) + { + kernel_ = kernel; + } - /** - * \param[in] boundary_options enum indicating the boundary options to be used for convolution - */ - inline void - setBoundaryOptions (BOUNDARY_OPTIONS_ENUM boundary_options) - { - boundary_options_ = boundary_options; - } + /** + * \param[in] boundary_options enum indicating the boundary options to be used for + * convolution + */ + inline void + setBoundaryOptions(BOUNDARY_OPTIONS_ENUM boundary_options) + { + boundary_options_ = boundary_options; + } - /** \brief Performs 2D convolution of the input point cloud with the kernel. - * Uses clamp as the default boundary option. - * \param[out] output Output point cloud passed by reference - */ - void - filter (pcl::PointCloud &output); + /** \brief Performs 2D convolution of the input point cloud with the kernel. + * Uses clamp as the default boundary option. + * \param[out] output Output point cloud passed by reference + */ + void + filter(pcl::PointCloud& output); - protected: - /** \brief This is an over-ride function for the pcl::Filter interface. */ - void - applyFilter (pcl::PointCloud &) {} +protected: + /** \brief This is an over-ride function for the pcl::Filter interface. */ + void + applyFilter(pcl::PointCloud&) override + {} - private: - BOUNDARY_OPTIONS_ENUM boundary_options_; - pcl::PointCloud kernel_; - }; -} +private: + BOUNDARY_OPTIONS_ENUM boundary_options_; + pcl::PointCloud kernel_; +}; +} // namespace pcl #include -POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZIEdge, - (float, x, x) - (float, y, y) - (float, z, z) - (float, magnitude, magnitude) - (float, direction, direction) - (float, magnitude_x, magnitude_x) - (float, magnitude_y, magnitude_y) -) -#endif // PCL_2D_CONVOLUTION_2D_H +POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointXYZIEdge, // + (float, x, x) // + (float, y, y) // + (float, z, z) // + (float, magnitude, magnitude) // + (float, direction, direction) // + (float, magnitude_x, magnitude_x) // + (float, magnitude_y, magnitude_y)) // diff --git a/2d/include/pcl/2d/edge.h b/2d/include/pcl/2d/edge.h index a0e059ed..504e31e9 100644 --- a/2d/include/pcl/2d/edge.h +++ b/2d/include/pcl/2d/edge.h @@ -35,274 +35,279 @@ * */ -#ifndef PCL_2D_EDGE_H -#define PCL_2D_EDGE_H +#pragma once -#include #include #include +#include +#include + +namespace pcl { + +template +class Edge { +private: + using PointCloudIn = pcl::PointCloud; + using PointCloudInPtr = typename PointCloudIn::Ptr; + + PointCloudInPtr input_; + pcl::Convolution convolution_; + kernel kernel_; + + /** \brief This function performs edge tracing for Canny Edge detector. + * + * \param[in] rowOffset row offset for direction in which the edge is to be traced + * \param[in] colOffset column offset for direction in which the edge is to be traced + * \param[in] row row location of the edge point + * \param[in] col column location of the edge point + * \param[out] maxima point cloud containing the edge information in the magnitude + * channel + */ + inline void + cannyTraceEdge(int rowOffset, + int colOffset, + int row, + int col, + pcl::PointCloud& maxima); + + /** \brief This function discretizes the edge directions in steps of 22.5 degrees. + * \param thet point cloud containing the edge information in the direction channel + */ + void + discretizeAngles(pcl::PointCloud& thet); + + /** \brief This function suppresses the edges which don't form a local maximum + * in the edge direction. + * \param[in] edges point cloud containing all the edges + * \param[out] maxima point cloud containing the non-max suppressed edges + * \param[in] tLow + */ + void + suppressNonMaxima(const pcl::PointCloud& edges, + pcl::PointCloud& maxima, + float tLow); + +public: + using Ptr = shared_ptr>; + using ConstPtr = shared_ptr>; + + enum OUTPUT_TYPE { + OUTPUT_Y, + OUTPUT_X, + OUTPUT_X_Y, + OUTPUT_MAGNITUDE, + OUTPUT_DIRECTION, + OUTPUT_MAGNITUDE_DIRECTION, + OUTPUT_ALL + }; -namespace pcl -{ - template - class Edge - { - private: - typedef typename pcl::PointCloud PointCloudIn; - typedef typename PointCloudIn::Ptr PointCloudInPtr; - - PointCloudInPtr input_; - pcl::Convolution convolution_; - kernel kernel_; - - /** \brief This function performs edge tracing for Canny Edge detector. - * - * \param[in] rowOffset row offset for direction in which the edge is to be traced - * \param[in] colOffset column offset for direction in which the edge is to be traced - * \param[in] row row location of the edge point - * \param[in] col column location of the edge point - * \param[out] maxima point cloud containing the edge information in the magnitude channel - */ - inline void - cannyTraceEdge (int rowOffset, int colOffset, int row, int col, - pcl::PointCloud &maxima); - - /** \brief This function discretizes the edge directions in steps of 22.5 degrees. - * \param thet point cloud containing the edge information in the direction channel - */ - void - discretizeAngles (pcl::PointCloud &thet); - - /** \brief This function suppresses the edges which don't form a local maximum - * in the edge direction. - * \param[in] edges point cloud containing all the edges - * \param[out] maxima point cloud containing the non-max suppressed edges - * \param[in] tLow - */ - void - suppressNonMaxima (const pcl::PointCloud &edges, - pcl::PointCloud &maxima, float tLow); - - public: - typedef boost::shared_ptr Ptr; - typedef boost::shared_ptr ConstPtr; - - enum OUTPUT_TYPE - { - OUTPUT_Y, - OUTPUT_X, - OUTPUT_X_Y, - OUTPUT_MAGNITUDE, - OUTPUT_DIRECTION, - OUTPUT_MAGNITUDE_DIRECTION, - OUTPUT_ALL - }; - - enum DETECTOR_KERNEL_TYPE - { - CANNY, - SOBEL, - PREWITT, - ROBERTS, - LOG, - DERIVATIVE_CENTRAL, - DERIVATIVE_FORWARD, - DERIVATIVE_BACKWARD - }; - - private: - OUTPUT_TYPE output_type_; - DETECTOR_KERNEL_TYPE detector_kernel_type_; - bool non_maximal_suppression_; - bool hysteresis_thresholding_; - - float hysteresis_threshold_low_; - float hysteresis_threshold_high_; - float non_max_suppression_radius_x_; - float non_max_suppression_radius_y_; - - public: - Edge () : - output_type_ (OUTPUT_X), - detector_kernel_type_ (SOBEL), - non_maximal_suppression_ (false), - hysteresis_thresholding_ (false), - hysteresis_threshold_low_ (20), - hysteresis_threshold_high_ (80), - non_max_suppression_radius_x_ (3), - non_max_suppression_radius_y_ (3) - { - } - - /** \brief Set the output type. - * \param[in] output_type the output type - */ - void - setOutputType (OUTPUT_TYPE output_type) - { - output_type_ = output_type; - } - - void - setHysteresisThresholdLow (float threshold) - { - hysteresis_threshold_low_ = threshold; - } - - void - setHysteresisThresholdHigh (float threshold) - { - hysteresis_threshold_high_ = threshold; - } - - /** - * \param[in] input_x - * \param[in] input_y - * \param[out] output - */ - void - sobelMagnitudeDirection (const pcl::PointCloud &input_x, - const pcl::PointCloud &input_y, - pcl::PointCloud &output); - - - /** \brief Perform Canny edge detection with two separated input images for - * horizontal and vertical derivatives. - * All edges of magnitude above t_high are always classified as edges. All edges - * below t_low are discarded. Edge values between t_low and t_high are classified - * as edges only if they are connected to edges having magnitude > t_high and are - * located in a direction perpendicular to that strong edge. - * - * \param[in] input_x Input point cloud passed by reference for the first derivative in the horizontal direction - * \param[in] input_y Input point cloud passed by reference for the first derivative in the vertical direction - * \param[out] output Output point cloud passed by reference - */ - void - canny (const pcl::PointCloud &input_x, - const pcl::PointCloud &input_y, - pcl::PointCloud &output); - - /** \brief This is a convenience function which performs edge detection based on - * the variable detector_kernel_type_ - * \param[out] output - */ - void - detectEdge (pcl::PointCloud &output); - - /** \brief All edges of magnitude above t_high are always classified as edges. - * All edges below t_low are discarded. - * Edge values between t_low and t_high are classified as edges only if they are - * connected to edges having magnitude > t_high and are located in a direction - * perpendicular to that strong edge. - * \param[out] output Output point cloud passed by reference - */ - void - detectEdgeCanny (pcl::PointCloud &output); - - /** \brief Uses the Sobel kernel for edge detection. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - detectEdgeSobel (pcl::PointCloud &output); - - /** \brief Uses the Prewitt kernel for edge detection. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - detectEdgePrewitt (pcl::PointCloud &output); - - /** \brief Uses the Roberts kernel for edge detection. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - detectEdgeRoberts (pcl::PointCloud &output); - - /** \brief Uses the LoG kernel for edge detection. - * Zero crossings of the Laplacian operator applied on an image indicate edges. - * Gaussian kernel is used to smoothen the image prior to the Laplacian. - * This is because Laplacian uses the second order derivative of the image and hence, is very sensitive to noise. - * The implementation is not two-step but rather applies the LoG kernel directly. - * - * \param[in] kernel_sigma variance of the LoG kernel used. - * \param[in] kernel_size a LoG kernel of dimensions kernel_size x kernel_size is used. - * \param[out] output Output point cloud passed by reference. - */ - void - detectEdgeLoG (const float kernel_sigma, const float kernel_size, - pcl::PointCloud &output); - - /** \brief Computes the image derivatives in X direction using the kernel kernel::derivativeYCentralKernel. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - computeDerivativeXCentral (pcl::PointCloud &output); - - /** \brief Computes the image derivatives in Y direction using the kernel kernel::derivativeYCentralKernel. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - computeDerivativeYCentral (pcl::PointCloud &output); - - /** \brief Computes the image derivatives in X direction using the kernel kernel::derivativeYForwardKernel. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - computeDerivativeXForward (pcl::PointCloud &output); - - /** \brief Computes the image derivatives in Y direction using the kernel kernel::derivativeYForwardKernel. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - computeDerivativeYForward (pcl::PointCloud &output); - - /** \brief Computes the image derivatives in X direction using the kernel kernel::derivativeXBackwardKernel. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param output Output point cloud passed by reference - */ - void - computeDerivativeXBackward (pcl::PointCloud &output); - - /** \brief Computes the image derivatives in Y direction using the kernel kernel::derivativeYBackwardKernel. - * This function does NOT include a smoothing step. - * The image should be smoothed before using this function to reduce noise. - * \param[out] output Output point cloud passed by reference - */ - void - computeDerivativeYBackward (pcl::PointCloud &output); - - /** \brief Override function to implement the pcl::Filter interface - */ - void - applyFilter (pcl::PointCloud& /*output*/) {} - - /** \brief Set the input point cloud pointer - * \param[in] input pointer to input point cloud - */ - void - setInputCloud (PointCloudInPtr input) - { - input_ = input; - } - - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + enum DETECTOR_KERNEL_TYPE { + CANNY, + SOBEL, + PREWITT, + ROBERTS, + LOG, + DERIVATIVE_CENTRAL, + DERIVATIVE_FORWARD, + DERIVATIVE_BACKWARD }; -} -#include -#endif // PCL_2D_EDGE_H +private: + OUTPUT_TYPE output_type_; + DETECTOR_KERNEL_TYPE detector_kernel_type_; + bool non_maximal_suppression_; + bool hysteresis_thresholding_; + + float hysteresis_threshold_low_; + float hysteresis_threshold_high_; + float non_max_suppression_radius_x_; + float non_max_suppression_radius_y_; + +public: + Edge() + : output_type_(OUTPUT_X) + , detector_kernel_type_(SOBEL) + , non_maximal_suppression_(false) + , hysteresis_thresholding_(false) + , hysteresis_threshold_low_(20) + , hysteresis_threshold_high_(80) + , non_max_suppression_radius_x_(3) + , non_max_suppression_radius_y_(3) + {} + + /** \brief Set the output type. + * \param[in] output_type the output type + */ + void + setOutputType(OUTPUT_TYPE output_type) + { + output_type_ = output_type; + } + + void + setHysteresisThresholdLow(float threshold) + { + hysteresis_threshold_low_ = threshold; + } + + void + setHysteresisThresholdHigh(float threshold) + { + hysteresis_threshold_high_ = threshold; + } + + /** + * \param[in] input_x + * \param[in] input_y + * \param[out] output + */ + void + sobelMagnitudeDirection(const pcl::PointCloud& input_x, + const pcl::PointCloud& input_y, + pcl::PointCloud& output); + + /** Perform Canny edge detection with two separated input images for horizontal and + * vertical derivatives. + * + * All edges of magnitude above t_high are always classified as edges. All edges + * below t_low are discarded. Edge values between t_low and t_high are classified + * as edges only if they are connected to edges having magnitude > t_high and are + * located in a direction perpendicular to that strong edge. + * + * \param[in] input_x Input point cloud passed by reference for the first derivative + * in the horizontal direction + * \param[in] input_y Input point cloud passed by reference for the first derivative + * in the vertical direction + * \param[out] output Output point cloud passed by reference + */ + void + canny(const pcl::PointCloud& input_x, + const pcl::PointCloud& input_y, + pcl::PointCloud& output); + + /** \brief This is a convenience function which performs edge detection based on + * the variable detector_kernel_type_ + * \param[out] output + */ + void + detectEdge(pcl::PointCloud& output); + + /** \brief All edges of magnitude above t_high are always classified as edges. + * All edges below t_low are discarded. + * Edge values between t_low and t_high are classified as edges only if they are + * connected to edges having magnitude > t_high and are located in a direction + * perpendicular to that strong edge. + * \param[out] output Output point cloud passed by reference + */ + void + detectEdgeCanny(pcl::PointCloud& output); + + /** \brief Uses the Sobel kernel for edge detection. + * This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + detectEdgeSobel(pcl::PointCloud& output); + + /** \brief Uses the Prewitt kernel for edge detection. + * This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + detectEdgePrewitt(pcl::PointCloud& output); + + /** \brief Uses the Roberts kernel for edge detection. + * This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + detectEdgeRoberts(pcl::PointCloud& output); + + /** \brief Uses the LoG kernel for edge detection. + * Zero crossings of the Laplacian operator applied on an image indicate edges. + * Gaussian kernel is used to smoothen the image prior to the Laplacian. + * This is because Laplacian uses the second order derivative of the image and hence, + * is very sensitive to noise. The implementation is not two-step but rather applies + * the LoG kernel directly. + * + * \param[in] kernel_sigma variance of the LoG kernel used. + * \param[in] kernel_size a LoG kernel of dimensions kernel_size x kernel_size is + * used. + * \param[out] output Output point cloud passed by reference. + */ + void + detectEdgeLoG(const float kernel_sigma, + const float kernel_size, + pcl::PointCloud& output); + + /** \brief Computes the image derivatives in X direction using the kernel + * kernel::derivativeYCentralKernel. This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + computeDerivativeXCentral(pcl::PointCloud& output); + + /** \brief Computes the image derivatives in Y direction using the kernel + * kernel::derivativeYCentralKernel. This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + computeDerivativeYCentral(pcl::PointCloud& output); + + /** \brief Computes the image derivatives in X direction using the kernel + * kernel::derivativeYForwardKernel. This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + computeDerivativeXForward(pcl::PointCloud& output); + + /** \brief Computes the image derivatives in Y direction using the kernel + * kernel::derivativeYForwardKernel. This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + computeDerivativeYForward(pcl::PointCloud& output); + + /** \brief Computes the image derivatives in X direction using the kernel + * kernel::derivativeXBackwardKernel. This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param output Output point cloud passed by reference + */ + void + computeDerivativeXBackward(pcl::PointCloud& output); + + /** \brief Computes the image derivatives in Y direction using the kernel + * kernel::derivativeYBackwardKernel. This function does NOT include a smoothing step. + * The image should be smoothed before using this function to reduce noise. + * \param[out] output Output point cloud passed by reference + */ + void + computeDerivativeYBackward(pcl::PointCloud& output); + + /** \brief Override function to implement the pcl::Filter interface */ + void + applyFilter(pcl::PointCloud& /*output*/) + {} + + /** \brief Set the input point cloud pointer + * \param[in] input pointer to input point cloud + */ + void + setInputCloud(PointCloudInPtr input) + { + input_ = input; + } + PCL_MAKE_ALIGNED_OPERATOR_NEW +}; + +} // namespace pcl + +#include diff --git a/2d/include/pcl/2d/impl/convolution.hpp b/2d/include/pcl/2d/impl/convolution.hpp index 0ded38e8..33198406 100644 --- a/2d/include/pcl/2d/impl/convolution.hpp +++ b/2d/include/pcl/2d/impl/convolution.hpp @@ -39,115 +39,99 @@ #define PCL_2D_CONVOLUTION_IMPL_HPP ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Convolution::filter (pcl::PointCloud &output) +template +void +pcl::Convolution::filter(pcl::PointCloud& output) { int input_row = 0; int input_col = 0; // default boundary option : zero padding output = *input_; - int iw = static_cast (input_->width), - ih = static_cast (input_->height), - kw = static_cast (kernel_.width), - kh = static_cast (kernel_.height); - switch (boundary_options_) - { - default: - case BOUNDARY_OPTION_CLAMP: - { - for (int i = 0; i < ih; i++) - { - for (int j = 0; j < iw; j++) - { - float intensity = 0; - for (int k = 0; k < kh; k++) - { - for (int l = 0; l < kw; l++) - { - int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2; - if (ikkh < 0) - input_row = 0; - else if (ikkh >= ih) - input_row = ih - 1; - else - input_row = ikkh; + int iw = static_cast(input_->width), ih = static_cast(input_->height), + kw = static_cast(kernel_.width), kh = static_cast(kernel_.height); + switch (boundary_options_) { + default: + case BOUNDARY_OPTION_CLAMP: { + for (int i = 0; i < ih; i++) { + for (int j = 0; j < iw; j++) { + float intensity = 0; + for (int k = 0; k < kh; k++) { + for (int l = 0; l < kw; l++) { + int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2; + if (ikkh < 0) + input_row = 0; + else if (ikkh >= ih) + input_row = ih - 1; + else + input_row = ikkh; - if (jlkw < 0) - input_col = 0; - else if (jlkw >= iw) - input_col = iw - 1; - else - input_col = jlkw; + if (jlkw < 0) + input_col = 0; + else if (jlkw >= iw) + input_col = iw - 1; + else + input_col = jlkw; - intensity += kernel_ (l, k).intensity * (*input_)(input_col, input_row).intensity; - } + intensity += + kernel_(l, k).intensity * (*input_)(input_col, input_row).intensity; } - output (j, i).intensity = intensity; } + output(j, i).intensity = intensity; } - break; } + break; + } - case BOUNDARY_OPTION_MIRROR: - { - for (int i = 0; i < ih; i++) - { - for (int j = 0; j < iw; j++) - { - float intensity = 0; - for (int k = 0; k < kh; k++) - { - for (int l = 0; l < kw; l++) - { - int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2; - if (ikkh < 0) - input_row = -ikkh - 1; - else if (ikkh >= ih) - input_row = 2 * ih - 1 - ikkh; - else - input_row = ikkh; + case BOUNDARY_OPTION_MIRROR: { + for (int i = 0; i < ih; i++) { + for (int j = 0; j < iw; j++) { + float intensity = 0; + for (int k = 0; k < kh; k++) { + for (int l = 0; l < kw; l++) { + int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2; + if (ikkh < 0) + input_row = -ikkh - 1; + else if (ikkh >= ih) + input_row = 2 * ih - 1 - ikkh; + else + input_row = ikkh; - if (jlkw < 0) - input_col = -jlkw - 1; - else if (jlkw >= iw) - input_col = 2 * iw - 1 - jlkw; - else - input_col = jlkw; + if (jlkw < 0) + input_col = -jlkw - 1; + else if (jlkw >= iw) + input_col = 2 * iw - 1 - jlkw; + else + input_col = jlkw; - intensity += kernel_ (l, k).intensity * ((*input_)(input_col, input_row).intensity); - } + intensity += + kernel_(l, k).intensity * ((*input_)(input_col, input_row).intensity); } - output (j, i).intensity = intensity; } + output(j, i).intensity = intensity; } - break; } - - case BOUNDARY_OPTION_ZERO_PADDING: - { - for (int i = 0; i < ih; i++) - { - for (int j = 0; j < iw; j++) - { - float intensity = 0; - for (int k = 0; k < kh; k++) - { - for (int l = 0; l < kw; l++) - { - int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2; - if (ikkh < 0 || ikkh >= ih || jlkw < 0 || jlkw >= iw) - continue; - else - intensity += kernel_ (l, k).intensity * ((*input_)(jlkw, ikkh).intensity); - } + break; + } + + case BOUNDARY_OPTION_ZERO_PADDING: { + for (int i = 0; i < ih; i++) { + for (int j = 0; j < iw; j++) { + float intensity = 0; + for (int k = 0; k < kh; k++) { + for (int l = 0; l < kw; l++) { + int ikkh = i + k - kh / 2, jlkw = j + l - kw / 2; + if (ikkh < 0 || ikkh >= ih || jlkw < 0 || jlkw >= iw) + continue; + intensity += kernel_(l, k).intensity * ((*input_)(jlkw, ikkh).intensity); } - output (j, i).intensity = intensity; } + output(j, i).intensity = intensity; } - break; } - } // switch + break; + } + } // switch } #endif diff --git a/2d/include/pcl/2d/impl/edge.hpp b/2d/include/pcl/2d/impl/edge.hpp index 24756609..ded9f698 100644 --- a/2d/include/pcl/2d/impl/edge.hpp +++ b/2d/include/pcl/2d/impl/edge.hpp @@ -40,358 +40,337 @@ #include #include // rad2deg() -#include ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::detectEdgeSobel ( - pcl::PointCloud &output) +template +void +pcl::Edge::detectEdgeSobel(pcl::PointCloud& output) { - //pcl::console::TicToc tt; - //tt.tic (); - convolution_.setInputCloud (input_); - pcl::PointCloud::Ptr kernel_x (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_x (new pcl::PointCloud); - kernel_.setKernelType (kernel::SOBEL_X); - kernel_.fetchKernel (*kernel_x); - convolution_.setKernel (*kernel_x); - convolution_.filter (*magnitude_x); - //PCL_ERROR ("Convolve X: %g\n", tt.toc ()); tt.tic (); - - pcl::PointCloud::Ptr kernel_y (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_y (new pcl::PointCloud); - kernel_.setKernelType (kernel::SOBEL_Y); - kernel_.fetchKernel (*kernel_y); - convolution_.setKernel (*kernel_y); - convolution_.filter (*magnitude_y); - //PCL_ERROR ("Convolve Y: %g\n", tt.toc ()); tt.tic (); + convolution_.setInputCloud(input_); + pcl::PointCloud::Ptr kernel_x(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_x(new pcl::PointCloud); + kernel_.setKernelType(kernel::SOBEL_X); + kernel_.fetchKernel(*kernel_x); + convolution_.setKernel(*kernel_x); + convolution_.filter(*magnitude_x); + + pcl::PointCloud::Ptr kernel_y(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_y(new pcl::PointCloud); + kernel_.setKernelType(kernel::SOBEL_Y); + kernel_.fetchKernel(*kernel_y); + convolution_.setKernel(*kernel_y); + convolution_.filter(*magnitude_y); const int height = input_->height; const int width = input_->width; - output.resize (height * width); + output.resize(height * width); output.height = height; output.width = width; - for (size_t i = 0; i < output.size (); ++i) - { + for (std::size_t i = 0; i < output.size(); ++i) { output[i].magnitude_x = (*magnitude_x)[i].intensity; output[i].magnitude_y = (*magnitude_y)[i].intensity; - output[i].magnitude = - std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + - (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); - output[i].direction = - atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); + output[i].magnitude = + std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + + (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); + output[i].direction = + std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); } - //PCL_ERROR ("Rest: %g\n", tt.toc ()); } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::sobelMagnitudeDirection ( - const pcl::PointCloud &input_x, - const pcl::PointCloud &input_y, - pcl::PointCloud &output) +template +void +pcl::Edge::sobelMagnitudeDirection( + const pcl::PointCloud& input_x, + const pcl::PointCloud& input_y, + pcl::PointCloud& output) { - convolution_.setInputCloud (input_x.makeShared()); - pcl::PointCloud::Ptr kernel_x (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_x (new pcl::PointCloud); - kernel_.setKernelType (kernel::SOBEL_X); - kernel_.fetchKernel (*kernel_x); - convolution_.setKernel (*kernel_x); - convolution_.filter (*magnitude_x); - - convolution_.setInputCloud (input_y.makeShared()); - pcl::PointCloud::Ptr kernel_y (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_y (new pcl::PointCloud); - kernel_.setKernelType (kernel::SOBEL_Y); - kernel_.fetchKernel (*kernel_y); - convolution_.setKernel (*kernel_y); - convolution_.filter (*magnitude_y); + convolution_.setInputCloud(input_x.makeShared()); + pcl::PointCloud::Ptr kernel_x(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_x(new pcl::PointCloud); + kernel_.setKernelType(kernel::SOBEL_X); + kernel_.fetchKernel(*kernel_x); + convolution_.setKernel(*kernel_x); + convolution_.filter(*magnitude_x); + + convolution_.setInputCloud(input_y.makeShared()); + pcl::PointCloud::Ptr kernel_y(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_y(new pcl::PointCloud); + kernel_.setKernelType(kernel::SOBEL_Y); + kernel_.fetchKernel(*kernel_y); + convolution_.setKernel(*kernel_y); + convolution_.filter(*magnitude_y); const int height = input_x.height; const int width = input_x.width; - output.resize (height * width); + output.resize(height * width); output.height = height; output.width = width; - for (size_t i = 0; i < output.size (); ++i) - { + for (std::size_t i = 0; i < output.size(); ++i) { output[i].magnitude_x = (*magnitude_x)[i].intensity; output[i].magnitude_y = (*magnitude_y)[i].intensity; - output[i].magnitude = - std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + - (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); - output[i].direction = - atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); + output[i].magnitude = + std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + + (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); + output[i].direction = + std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::detectEdgePrewitt (pcl::PointCloud &output) +template +void +pcl::Edge::detectEdgePrewitt(pcl::PointCloud& output) { - convolution_.setInputCloud (input_); - - pcl::PointCloud::Ptr kernel_x (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_x (new pcl::PointCloud); - kernel_.setKernelType (kernel::PREWITT_X); - kernel_.fetchKernel (*kernel_x); - convolution_.setKernel (*kernel_x); - convolution_.filter (*magnitude_x); - - pcl::PointCloud::Ptr kernel_y (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_y (new pcl::PointCloud); - kernel_.setKernelType (kernel::PREWITT_Y); - kernel_.fetchKernel (*kernel_y); - convolution_.setKernel (*kernel_y); - convolution_.filter (*magnitude_y); + convolution_.setInputCloud(input_); + + pcl::PointCloud::Ptr kernel_x(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_x(new pcl::PointCloud); + kernel_.setKernelType(kernel::PREWITT_X); + kernel_.fetchKernel(*kernel_x); + convolution_.setKernel(*kernel_x); + convolution_.filter(*magnitude_x); + + pcl::PointCloud::Ptr kernel_y(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_y(new pcl::PointCloud); + kernel_.setKernelType(kernel::PREWITT_Y); + kernel_.fetchKernel(*kernel_y); + convolution_.setKernel(*kernel_y); + convolution_.filter(*magnitude_y); const int height = input_->height; const int width = input_->width; - output.resize (height * width); + output.resize(height * width); output.height = height; output.width = width; - for (size_t i = 0; i < output.size (); ++i) - { + for (std::size_t i = 0; i < output.size(); ++i) { output[i].magnitude_x = (*magnitude_x)[i].intensity; output[i].magnitude_y = (*magnitude_y)[i].intensity; - output[i].magnitude = - std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + - (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); - output[i].direction = - atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); + output[i].magnitude = + std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + + (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); + output[i].direction = + std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::detectEdgeRoberts (pcl::PointCloud &output) +template +void +pcl::Edge::detectEdgeRoberts(pcl::PointCloud& output) { - convolution_.setInputCloud (input_); - - pcl::PointCloud::Ptr kernel_x (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_x (new pcl::PointCloud); - kernel_.setKernelType (kernel::ROBERTS_X); - kernel_.fetchKernel (*kernel_x); - convolution_.setKernel (*kernel_x); - convolution_.filter (*magnitude_x); - - pcl::PointCloud::Ptr kernel_y (new pcl::PointCloud); - pcl::PointCloud::Ptr magnitude_y (new pcl::PointCloud); - kernel_.setKernelType (kernel::ROBERTS_Y); - kernel_.fetchKernel (*kernel_y); - convolution_.setKernel (*kernel_y); - convolution_.filter (*magnitude_y); + convolution_.setInputCloud(input_); + + pcl::PointCloud::Ptr kernel_x(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_x(new pcl::PointCloud); + kernel_.setKernelType(kernel::ROBERTS_X); + kernel_.fetchKernel(*kernel_x); + convolution_.setKernel(*kernel_x); + convolution_.filter(*magnitude_x); + + pcl::PointCloud::Ptr kernel_y(new pcl::PointCloud); + pcl::PointCloud::Ptr magnitude_y(new pcl::PointCloud); + kernel_.setKernelType(kernel::ROBERTS_Y); + kernel_.fetchKernel(*kernel_y); + convolution_.setKernel(*kernel_y); + convolution_.filter(*magnitude_y); const int height = input_->height; const int width = input_->width; - output.resize (height * width); + output.resize(height * width); output.height = height; output.width = width; - for (size_t i = 0; i < output.size (); ++i) - { + for (std::size_t i = 0; i < output.size(); ++i) { output[i].magnitude_x = (*magnitude_x)[i].intensity; output[i].magnitude_y = (*magnitude_y)[i].intensity; - output[i].magnitude = - std::sqrt ((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + - (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); - output[i].direction = - atan2f ((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); + output[i].magnitude = + std::sqrt((*magnitude_x)[i].intensity * (*magnitude_x)[i].intensity + + (*magnitude_y)[i].intensity * (*magnitude_y)[i].intensity); + output[i].direction = + std::atan2((*magnitude_y)[i].intensity, (*magnitude_x)[i].intensity); } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::cannyTraceEdge ( - int rowOffset, int colOffset, int row, int col, - pcl::PointCloud &maxima) +template +void +pcl::Edge::cannyTraceEdge( + int rowOffset, int colOffset, int row, int col, pcl::PointCloud& maxima) { int newRow = row + rowOffset; int newCol = col + colOffset; - PointXYZI &pt = maxima (newCol, newRow); + PointXYZI& pt = maxima(newCol, newRow); - if (newRow > 0 && newRow < static_cast (maxima.height) && newCol > 0 && newCol < static_cast (maxima.width)) - { - if (pt.intensity == 0.0f || pt.intensity == std::numeric_limits::max ()) + if (newRow > 0 && newRow < static_cast(maxima.height) && newCol > 0 && + newCol < static_cast(maxima.width)) { + if (pt.intensity == 0.0f || pt.intensity == std::numeric_limits::max()) return; - pt.intensity = std::numeric_limits::max (); - cannyTraceEdge ( 1, 0, newRow, newCol, maxima); - cannyTraceEdge (-1, 0, newRow, newCol, maxima); - cannyTraceEdge ( 1, 1, newRow, newCol, maxima); - cannyTraceEdge (-1, -1, newRow, newCol, maxima); - cannyTraceEdge ( 0, -1, newRow, newCol, maxima); - cannyTraceEdge ( 0, 1, newRow, newCol, maxima); - cannyTraceEdge (-1, 1, newRow, newCol, maxima); - cannyTraceEdge ( 1, -1, newRow, newCol, maxima); + pt.intensity = std::numeric_limits::max(); + cannyTraceEdge(1, 0, newRow, newCol, maxima); + cannyTraceEdge(-1, 0, newRow, newCol, maxima); + cannyTraceEdge(1, 1, newRow, newCol, maxima); + cannyTraceEdge(-1, -1, newRow, newCol, maxima); + cannyTraceEdge(0, -1, newRow, newCol, maxima); + cannyTraceEdge(0, 1, newRow, newCol, maxima); + cannyTraceEdge(-1, 1, newRow, newCol, maxima); + cannyTraceEdge(1, -1, newRow, newCol, maxima); } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::discretizeAngles (pcl::PointCloud &thet) +template +void +pcl::Edge::discretizeAngles(pcl::PointCloud& thet) { const int height = thet.height; const int width = thet.width; float angle; - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { - angle = pcl::rad2deg (thet (j, i).direction); - if (((angle <= 22.5) && (angle >= -22.5)) || (angle >= 157.5) || (angle <= -157.5)) - thet (j, i).direction = 0; - else - if (((angle > 22.5) && (angle < 67.5)) || ((angle < -112.5) && (angle > -157.5))) - thet (j, i).direction = 45; - else - if (((angle >= 67.5) && (angle <= 112.5)) || ((angle <= -67.5) && (angle >= -112.5))) - thet (j, i).direction = 90; - else - if (((angle > 112.5) && (angle < 157.5)) || ((angle < -22.5) && (angle > -67.5))) - thet (j, i).direction = 135; + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + angle = pcl::rad2deg(thet(j, i).direction); + if (((angle <= 22.5) && (angle >= -22.5)) || (angle >= 157.5) || + (angle <= -157.5)) + thet(j, i).direction = 0; + else if (((angle > 22.5) && (angle < 67.5)) || + ((angle < -112.5) && (angle > -157.5))) + thet(j, i).direction = 45; + else if (((angle >= 67.5) && (angle <= 112.5)) || + ((angle <= -67.5) && (angle >= -112.5))) + thet(j, i).direction = 90; + else if (((angle > 112.5) && (angle < 157.5)) || + ((angle < -22.5) && (angle > -67.5))) + thet(j, i).direction = 135; } } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::suppressNonMaxima ( - const pcl::PointCloud &edges, - pcl::PointCloud &maxima, float tLow) +template +void +pcl::Edge::suppressNonMaxima( + const pcl::PointCloud& edges, + pcl::PointCloud& maxima, + float tLow) { const int height = edges.height; const int width = edges.width; maxima.height = height; maxima.width = width; - maxima.resize (height * width); + maxima.resize(height * width); - for (size_t i = 0; i < maxima.size (); ++i) - maxima[i].intensity = 0.0f; + for (auto& point : maxima) + point.intensity = 0.0f; // tHigh and non-maximal supression - for (int i = 1; i < height - 1; i++) - { - for (int j = 1; j < width - 1; j++) - { - const PointXYZIEdge &ptedge = edges (j, i); - PointXYZI &ptmax = maxima (j, i); + for (int i = 1; i < height - 1; i++) { + for (int j = 1; j < width - 1; j++) { + const PointXYZIEdge& ptedge = edges(j, i); + PointXYZI& ptmax = maxima(j, i); if (ptedge.magnitude < tLow) continue; - //maxima (j, i).intensity = 0; - - switch (int (ptedge.direction)) - { - case 0: - { - if (ptedge.magnitude >= edges (j - 1, i).magnitude && - ptedge.magnitude >= edges (j + 1, i).magnitude) - ptmax.intensity = ptedge.magnitude; - break; - } - case 45: - { - if (ptedge.magnitude >= edges (j - 1, i - 1).magnitude && - ptedge.magnitude >= edges (j + 1, i + 1).magnitude) - ptmax.intensity = ptedge.magnitude; - break; - } - case 90: - { - if (ptedge.magnitude >= edges (j, i - 1).magnitude && - ptedge.magnitude >= edges (j, i + 1).magnitude) - ptmax.intensity = ptedge.magnitude; - break; - } - case 135: - { - if (ptedge.magnitude >= edges (j + 1, i - 1).magnitude && - ptedge.magnitude >= edges (j - 1, i + 1).magnitude) - ptmax.intensity = ptedge.magnitude; - break; - } + // maxima (j, i).intensity = 0; + + switch (int(ptedge.direction)) { + case 0: { + if (ptedge.magnitude >= edges(j - 1, i).magnitude && + ptedge.magnitude >= edges(j + 1, i).magnitude) + ptmax.intensity = ptedge.magnitude; + break; + } + case 45: { + if (ptedge.magnitude >= edges(j - 1, i - 1).magnitude && + ptedge.magnitude >= edges(j + 1, i + 1).magnitude) + ptmax.intensity = ptedge.magnitude; + break; + } + case 90: { + if (ptedge.magnitude >= edges(j, i - 1).magnitude && + ptedge.magnitude >= edges(j, i + 1).magnitude) + ptmax.intensity = ptedge.magnitude; + break; + } + case 135: { + if (ptedge.magnitude >= edges(j + 1, i - 1).magnitude && + ptedge.magnitude >= edges(j - 1, i + 1).magnitude) + ptmax.intensity = ptedge.magnitude; + break; + } } } } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::detectEdgeCanny (pcl::PointCloud &output) +template +void +pcl::Edge::detectEdgeCanny(pcl::PointCloud& output) { float tHigh = hysteresis_threshold_high_; float tLow = hysteresis_threshold_low_; const int height = input_->height; const int width = input_->width; - output.resize (height * width); + output.resize(height * width); output.height = height; output.width = width; - //pcl::console::TicToc tt; - //tt.tic (); - // Noise reduction using gaussian blurring - pcl::PointCloud::Ptr gaussian_kernel (new pcl::PointCloud); - PointCloudInPtr smoothed_cloud (new PointCloudIn); - kernel_.setKernelSize (3); - kernel_.setKernelSigma (1.0); - kernel_.setKernelType (kernel::GAUSSIAN); - kernel_.fetchKernel (*gaussian_kernel); - convolution_.setKernel (*gaussian_kernel); - convolution_.setInputCloud (input_); - convolution_.filter (*smoothed_cloud); - //PCL_ERROR ("Gaussian blur: %g\n", tt.toc ()); tt.tic (); - + pcl::PointCloud::Ptr gaussian_kernel(new pcl::PointCloud); + PointCloudInPtr smoothed_cloud(new PointCloudIn); + kernel_.setKernelSize(3); + kernel_.setKernelSigma(1.0); + kernel_.setKernelType(kernel::GAUSSIAN); + kernel_.fetchKernel(*gaussian_kernel); + convolution_.setKernel(*gaussian_kernel); + convolution_.setInputCloud(input_); + convolution_.filter(*smoothed_cloud); + // Edge detection using Sobel - pcl::PointCloud::Ptr edges (new pcl::PointCloud); - setInputCloud (smoothed_cloud); - detectEdgeSobel (*edges); - //PCL_ERROR ("Sobel: %g\n", tt.toc ()); tt.tic (); - + pcl::PointCloud::Ptr edges(new pcl::PointCloud); + setInputCloud(smoothed_cloud); + detectEdgeSobel(*edges); + // Edge discretization - discretizeAngles (*edges); - //PCL_ERROR ("Discretize: %g\n", tt.toc ()); tt.tic (); + discretizeAngles(*edges); // tHigh and non-maximal supression - pcl::PointCloud::Ptr maxima (new pcl::PointCloud); - suppressNonMaxima (*edges, *maxima, tLow); - //PCL_ERROR ("NM suppress: %g\n", tt.toc ()); tt.tic (); + pcl::PointCloud::Ptr maxima(new pcl::PointCloud); + suppressNonMaxima(*edges, *maxima, tLow); // Edge tracing - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { - if ((*maxima)(j, i).intensity < tHigh || (*maxima)(j, i).intensity == std::numeric_limits::max ()) + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + if ((*maxima)(j, i).intensity < tHigh || + (*maxima)(j, i).intensity == std::numeric_limits::max()) continue; - (*maxima)(j, i).intensity = std::numeric_limits::max (); - cannyTraceEdge ( 1, 0, i, j, *maxima); - cannyTraceEdge (-1, 0, i, j, *maxima); - cannyTraceEdge ( 1, 1, i, j, *maxima); - cannyTraceEdge (-1, -1, i, j, *maxima); - cannyTraceEdge ( 0, -1, i, j, *maxima); - cannyTraceEdge ( 0, 1, i, j, *maxima); - cannyTraceEdge (-1, 1, i, j, *maxima); - cannyTraceEdge ( 1, -1, i, j, *maxima); + (*maxima)(j, i).intensity = std::numeric_limits::max(); + cannyTraceEdge(1, 0, i, j, *maxima); + cannyTraceEdge(-1, 0, i, j, *maxima); + cannyTraceEdge(1, 1, i, j, *maxima); + cannyTraceEdge(-1, -1, i, j, *maxima); + cannyTraceEdge(0, -1, i, j, *maxima); + cannyTraceEdge(0, 1, i, j, *maxima); + cannyTraceEdge(-1, 1, i, j, *maxima); + cannyTraceEdge(1, -1, i, j, *maxima); } } - //PCL_ERROR ("Edge tracing: %g\n", tt.toc ()); // Final thresholding - for (size_t i = 0; i < input_->size (); ++i) - { - if ((*maxima)[i].intensity == std::numeric_limits::max ()) + for (std::size_t i = 0; i < input_->size(); ++i) { + if ((*maxima)[i].intensity == std::numeric_limits::max()) output[i].magnitude = 255; else output[i].magnitude = 0; @@ -399,96 +378,96 @@ pcl::Edge::detectEdgeCanny (pcl::PointCloud &out } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::canny ( - const pcl::PointCloud &input_x, - const pcl::PointCloud &input_y, - pcl::PointCloud &output) +template +void +pcl::Edge::canny(const pcl::PointCloud& input_x, + const pcl::PointCloud& input_y, + pcl::PointCloud& output) { float tHigh = hysteresis_threshold_high_; float tLow = hysteresis_threshold_low_; const int height = input_x.height; const int width = input_x.width; - output.resize (height * width); + output.resize(height * width); output.height = height; output.width = width; // Noise reduction using gaussian blurring - pcl::PointCloud::Ptr gaussian_kernel (new pcl::PointCloud); - kernel_.setKernelSize (3); - kernel_.setKernelSigma (1.0); - kernel_.setKernelType (kernel::GAUSSIAN); - kernel_.fetchKernel (*gaussian_kernel); - convolution_.setKernel (*gaussian_kernel); + pcl::PointCloud::Ptr gaussian_kernel(new pcl::PointCloud); + kernel_.setKernelSize(3); + kernel_.setKernelSigma(1.0); + kernel_.setKernelType(kernel::GAUSSIAN); + kernel_.fetchKernel(*gaussian_kernel); + convolution_.setKernel(*gaussian_kernel); PointCloudIn smoothed_cloud_x; - convolution_.setInputCloud (input_x.makeShared()); - convolution_.filter (smoothed_cloud_x); + convolution_.setInputCloud(input_x.makeShared()); + convolution_.filter(smoothed_cloud_x); PointCloudIn smoothed_cloud_y; - convolution_.setInputCloud (input_y.makeShared()); - convolution_.filter (smoothed_cloud_y); - + convolution_.setInputCloud(input_y.makeShared()); + convolution_.filter(smoothed_cloud_y); // Edge detection using Sobel - pcl::PointCloud::Ptr edges (new pcl::PointCloud); - sobelMagnitudeDirection (smoothed_cloud_x, smoothed_cloud_y, *edges.get ()); + pcl::PointCloud::Ptr edges(new pcl::PointCloud); + sobelMagnitudeDirection(smoothed_cloud_x, smoothed_cloud_y, *edges.get()); // Edge discretization - discretizeAngles (*edges); + discretizeAngles(*edges); - pcl::PointCloud::Ptr maxima (new pcl::PointCloud); - suppressNonMaxima (*edges, *maxima, tLow); + pcl::PointCloud::Ptr maxima(new pcl::PointCloud); + suppressNonMaxima(*edges, *maxima, tLow); // Edge tracing - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { - if ((*maxima)(j, i).intensity < tHigh || (*maxima)(j, i).intensity == std::numeric_limits::max ()) + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + if ((*maxima)(j, i).intensity < tHigh || + (*maxima)(j, i).intensity == std::numeric_limits::max()) continue; - (*maxima)(j, i).intensity = std::numeric_limits::max (); - cannyTraceEdge ( 1, 0, i, j, *maxima); - cannyTraceEdge (-1, 0, i, j, *maxima); - cannyTraceEdge ( 1, 1, i, j, *maxima); - cannyTraceEdge (-1, -1, i, j, *maxima); - cannyTraceEdge ( 0, -1, i, j, *maxima); - cannyTraceEdge ( 0, 1, i, j, *maxima); - cannyTraceEdge (-1, 1, i, j, *maxima); - cannyTraceEdge ( 1, -1, i, j, *maxima); + (*maxima)(j, i).intensity = std::numeric_limits::max(); + + // clang-format off + cannyTraceEdge( 1, 0, i, j, *maxima); + cannyTraceEdge(-1, 0, i, j, *maxima); + cannyTraceEdge( 1, 1, i, j, *maxima); + cannyTraceEdge(-1, -1, i, j, *maxima); + cannyTraceEdge( 0, -1, i, j, *maxima); + cannyTraceEdge( 0, 1, i, j, *maxima); + cannyTraceEdge(-1, 1, i, j, *maxima); + cannyTraceEdge( 1, -1, i, j, *maxima); + // clang-format on } } // Final thresholding - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { - if ((*maxima)(j, i).intensity == std::numeric_limits::max ()) - output (j, i).magnitude = 255; + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + if ((*maxima)(j, i).intensity == std::numeric_limits::max()) + output(j, i).magnitude = 255; else - output (j, i).magnitude = 0; + output(j, i).magnitude = 0; } } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Edge::detectEdgeLoG ( - const float kernel_sigma, const float kernel_size, - pcl::PointCloud &output) +template +void +pcl::Edge::detectEdgeLoG(const float kernel_sigma, + const float kernel_size, + pcl::PointCloud& output) { - convolution_.setInputCloud (input_); - - pcl::PointCloud::Ptr log_kernel (new pcl::PointCloud); - kernel_.setKernelType (kernel::LOG); - kernel_.setKernelSigma (kernel_sigma); - kernel_.setKernelSize (kernel_size); - kernel_.fetchKernel (*log_kernel); - convolution_.setKernel (*log_kernel); - convolution_.filter (output); + convolution_.setInputCloud(input_); + + pcl::PointCloud::Ptr log_kernel(new pcl::PointCloud); + kernel_.setKernelType(kernel::LOG); + kernel_.setKernelSigma(kernel_sigma); + kernel_.setKernelSize(kernel_size); + kernel_.fetchKernel(*log_kernel); + convolution_.setKernel(*log_kernel); + convolution_.filter(output); } #endif diff --git a/2d/include/pcl/2d/impl/kernel.hpp b/2d/include/pcl/2d/impl/kernel.hpp index 223fba8c..d85de7e6 100644 --- a/2d/include/pcl/2d/impl/kernel.hpp +++ b/2d/include/pcl/2d/impl/kernel.hpp @@ -39,290 +39,315 @@ #define PCL_2D_KERNEL_IMPL_HPP ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::fetchKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::fetchKernel(pcl::PointCloud& kernel) { - switch (kernel_type_) - { - case SOBEL_X: - { - sobelKernelX (kernel); - break; - } - case SOBEL_Y: - { - sobelKernelY (kernel); - break; - } - case PREWITT_X: - { - prewittKernelX (kernel); - break; - } - case PREWITT_Y: - { - prewittKernelY (kernel); - break; - } - case ROBERTS_X: - { - robertsKernelX (kernel); - break; - } - case ROBERTS_Y: - { - robertsKernelY (kernel); - break; - } - case LOG: - { - loGKernel (kernel); - break; - } - case DERIVATIVE_CENTRAL_X: - { - derivativeXCentralKernel (kernel); - break; - } - case DERIVATIVE_FORWARD_X: - { - derivativeXForwardKernel (kernel); - break; - } - case DERIVATIVE_BACKWARD_X: - { - derivativeXBackwardKernel (kernel); - break; - } - case DERIVATIVE_CENTRAL_Y: - { - derivativeYCentralKernel (kernel); - break; - } - case DERIVATIVE_FORWARD_Y: - { - derivativeYForwardKernel (kernel); - break; - } - case DERIVATIVE_BACKWARD_Y: - { - derivativeYBackwardKernel (kernel); - break; - } - case GAUSSIAN: - { - gaussianKernel (kernel); - break; - } + switch (kernel_type_) { + case SOBEL_X: + sobelKernelX(kernel); + break; + case SOBEL_Y: + sobelKernelY(kernel); + break; + case PREWITT_X: + prewittKernelX(kernel); + break; + case PREWITT_Y: + prewittKernelY(kernel); + break; + case ROBERTS_X: + robertsKernelX(kernel); + break; + case ROBERTS_Y: + robertsKernelY(kernel); + break; + case LOG: + loGKernel(kernel); + break; + case DERIVATIVE_CENTRAL_X: + derivativeXCentralKernel(kernel); + break; + case DERIVATIVE_FORWARD_X: + derivativeXForwardKernel(kernel); + break; + case DERIVATIVE_BACKWARD_X: + derivativeXBackwardKernel(kernel); + break; + case DERIVATIVE_CENTRAL_Y: + derivativeYCentralKernel(kernel); + break; + case DERIVATIVE_FORWARD_Y: + derivativeYForwardKernel(kernel); + break; + case DERIVATIVE_BACKWARD_Y: + derivativeYBackwardKernel(kernel); + break; + case GAUSSIAN: + gaussianKernel(kernel); + break; } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::gaussianKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::gaussianKernel(pcl::PointCloud& kernel) { float sum = 0; - kernel.resize (kernel_size_ * kernel_size_); + kernel.resize(kernel_size_ * kernel_size_); kernel.height = kernel_size_; kernel.width = kernel_size_; double sigma_sqr = 2 * sigma_ * sigma_; - for (int i = 0; i < kernel_size_; i++) - { - for (int j = 0; j < kernel_size_; j++) - { + for (int i = 0; i < kernel_size_; i++) { + for (int j = 0; j < kernel_size_; j++) { int iks = (i - kernel_size_ / 2); int jks = (j - kernel_size_ / 2); - kernel (j, i).intensity = expf (float (- double (iks * iks + jks * jks) / sigma_sqr)); - sum += float (kernel (j, i).intensity); + kernel(j, i).intensity = + std::exp(float(-double(iks * iks + jks * jks) / sigma_sqr)); + sum += float(kernel(j, i).intensity); } } // Normalizing the kernel - for (size_t i = 0; i < kernel.size (); ++i) + for (std::size_t i = 0; i < kernel.size(); ++i) kernel[i].intensity /= sum; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::loGKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::loGKernel(pcl::PointCloud& kernel) { float sum = 0; float temp = 0; - kernel.resize (kernel_size_ * kernel_size_); + kernel.resize(kernel_size_ * kernel_size_); kernel.height = kernel_size_; kernel.width = kernel_size_; double sigma_sqr = 2 * sigma_ * sigma_; - - for (int i = 0; i < kernel_size_; i++) - { - for (int j = 0; j < kernel_size_; j++) - { - int iks = (i - kernel_size_ / 2); - int jks = (j - kernel_size_ / 2); - temp = float (double (iks * iks + jks * jks) / sigma_sqr); - kernel (j, i).intensity = (1.0f - temp) * expf (-temp); - sum += kernel (j, i).intensity; + + for (int i = 0; i < kernel_size_; i++) { + for (int j = 0; j < kernel_size_; j++) { + int iks = (i - kernel_size_ / 2); + int jks = (j - kernel_size_ / 2); + temp = float(double(iks * iks + jks * jks) / sigma_sqr); + kernel(j, i).intensity = (1.0f - temp) * std::exp(-temp); + sum += kernel(j, i).intensity; } } // Normalizing the kernel - for (size_t i = 0; i < kernel.size (); ++i) + for (std::size_t i = 0; i < kernel.size(); ++i) kernel[i].intensity /= sum; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::sobelKernelX (pcl::PointCloud &kernel) +template +void +pcl::kernel::sobelKernelX(pcl::PointCloud& kernel) { - kernel.resize (9); + kernel.resize(9); kernel.height = 3; kernel.width = 3; - kernel (0, 0).intensity = -1; kernel (1, 0).intensity = 0; kernel (2, 0).intensity = 1; - kernel (0, 1).intensity = -2; kernel (1, 1).intensity = 0; kernel (2, 1).intensity = 2; - kernel (0, 2).intensity = -1; kernel (1, 2).intensity = 0; kernel (2, 2).intensity = 1; + kernel(0, 0).intensity = -1; + kernel(1, 0).intensity = 0; + kernel(2, 0).intensity = 1; + kernel(0, 1).intensity = -2; + kernel(1, 1).intensity = 0; + kernel(2, 1).intensity = 2; + kernel(0, 2).intensity = -1; + kernel(1, 2).intensity = 0; + kernel(2, 2).intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::prewittKernelX (pcl::PointCloud &kernel) +template +void +pcl::kernel::prewittKernelX(pcl::PointCloud& kernel) { - kernel.resize (9); + kernel.resize(9); kernel.height = 3; kernel.width = 3; - kernel (0, 0).intensity = -1; kernel (1, 0).intensity = 0; kernel (2, 0).intensity = 1; - kernel (0, 1).intensity = -1; kernel (1, 1).intensity = 0; kernel (2, 1).intensity = 1; - kernel (0, 2).intensity = -1; kernel (1, 2).intensity = 0; kernel (2, 2).intensity = 1; + kernel(0, 0).intensity = -1; + kernel(1, 0).intensity = 0; + kernel(2, 0).intensity = 1; + kernel(0, 1).intensity = -1; + kernel(1, 1).intensity = 0; + kernel(2, 1).intensity = 1; + kernel(0, 2).intensity = -1; + kernel(1, 2).intensity = 0; + kernel(2, 2).intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::robertsKernelX (pcl::PointCloud &kernel) +template +void +pcl::kernel::robertsKernelX(pcl::PointCloud& kernel) { - kernel.resize (4); + kernel.resize(4); kernel.height = 2; kernel.width = 2; - kernel (0, 0).intensity = 1; kernel (1, 0).intensity = 0; - kernel (0, 1).intensity = 0; kernel (1, 1).intensity = -1; + kernel(0, 0).intensity = 1; + kernel(1, 0).intensity = 0; + kernel(0, 1).intensity = 0; + kernel(1, 1).intensity = -1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::sobelKernelY (pcl::PointCloud &kernel) +template +void +pcl::kernel::sobelKernelY(pcl::PointCloud& kernel) { - kernel.resize (9); + kernel.resize(9); kernel.height = 3; kernel.width = 3; - kernel (0, 0).intensity = -1; kernel (1, 0).intensity = -2; kernel (2, 0).intensity = -1; - kernel (0, 1).intensity = 0; kernel (1, 1).intensity = 0; kernel (2, 1).intensity = 0; - kernel (0, 2).intensity = 1; kernel (1, 2).intensity = 2; kernel (2, 2).intensity = 1; + kernel(0, 0).intensity = -1; + kernel(1, 0).intensity = -2; + kernel(2, 0).intensity = -1; + kernel(0, 1).intensity = 0; + kernel(1, 1).intensity = 0; + kernel(2, 1).intensity = 0; + kernel(0, 2).intensity = 1; + kernel(1, 2).intensity = 2; + kernel(2, 2).intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::prewittKernelY (pcl::PointCloud &kernel) +template +void +pcl::kernel::prewittKernelY(pcl::PointCloud& kernel) { - kernel.resize (9); + kernel.resize(9); kernel.height = 3; kernel.width = 3; - kernel (0, 0).intensity = 1; kernel (1, 0).intensity = 1; kernel (2, 0).intensity = 1; - kernel (0, 1).intensity = 0; kernel (1, 1).intensity = 0; kernel (2, 1).intensity = 0; - kernel (0, 2).intensity = -1; kernel (1, 2).intensity = -1; kernel (2, 2).intensity = -1; + kernel(0, 0).intensity = 1; + kernel(1, 0).intensity = 1; + kernel(2, 0).intensity = 1; + kernel(0, 1).intensity = 0; + kernel(1, 1).intensity = 0; + kernel(2, 1).intensity = 0; + kernel(0, 2).intensity = -1; + kernel(1, 2).intensity = -1; + kernel(2, 2).intensity = -1; } -template void -pcl::kernel::robertsKernelY (pcl::PointCloud &kernel) +template +void +pcl::kernel::robertsKernelY(pcl::PointCloud& kernel) { - kernel.resize (4); + kernel.resize(4); kernel.height = 2; kernel.width = 2; - kernel (0, 0).intensity = 0; kernel (1, 0).intensity = 1; - kernel (0, 1).intensity = -1; kernel (1, 1).intensity = 0; + kernel(0, 0).intensity = 0; + kernel(1, 0).intensity = 1; + kernel(0, 1).intensity = -1; + kernel(1, 1).intensity = 0; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::derivativeXCentralKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::derivativeXCentralKernel(pcl::PointCloud& kernel) { - kernel.resize (3); + kernel.resize(3); kernel.height = 1; kernel.width = 3; - kernel (0, 0).intensity = -1; kernel (1, 0).intensity = 0; kernel (2, 0).intensity = 1; + kernel(0, 0).intensity = -1; + kernel(1, 0).intensity = 0; + kernel(2, 0).intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::derivativeXForwardKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::derivativeXForwardKernel(pcl::PointCloud& kernel) { - kernel.resize (3); + kernel.resize(3); kernel.height = 1; kernel.width = 3; - kernel (0, 0).intensity = 0; kernel (1, 0).intensity = -1; kernel (2, 0).intensity = 1; + kernel(0, 0).intensity = 0; + kernel(1, 0).intensity = -1; + kernel(2, 0).intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::derivativeXBackwardKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::derivativeXBackwardKernel(pcl::PointCloud& kernel) { - kernel.resize (3); + kernel.resize(3); kernel.height = 1; kernel.width = 3; - kernel (0, 0).intensity = -1; kernel (1, 0).intensity = 1; kernel (2, 0).intensity = 0; + kernel(0, 0).intensity = -1; + kernel(1, 0).intensity = 1; + kernel(2, 0).intensity = 0; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::derivativeYCentralKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::derivativeYCentralKernel(pcl::PointCloud& kernel) { - kernel.resize (3); + kernel.resize(3); kernel.height = 3; kernel.width = 1; - kernel (0, 0).intensity = -1; kernel (0, 1).intensity = 0; kernel (0, 2).intensity = 1; + kernel(0, 0).intensity = -1; + kernel(0, 1).intensity = 0; + kernel(0, 2).intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::derivativeYForwardKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::derivativeYForwardKernel(pcl::PointCloud& kernel) { - kernel.resize (3); + kernel.resize(3); kernel.height = 3; kernel.width = 1; - kernel (0, 0).intensity = 0; kernel (0, 1).intensity = -1; kernel (0, 2).intensity = 1; + kernel(0, 0).intensity = 0; + kernel(0, 1).intensity = -1; + kernel(0, 2).intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::derivativeYBackwardKernel (pcl::PointCloud &kernel) +template +void +pcl::kernel::derivativeYBackwardKernel(pcl::PointCloud& kernel) { - kernel.resize (3); + kernel.resize(3); kernel.height = 3; kernel.width = 1; - kernel (0, 0).intensity = -1; kernel (0, 1).intensity = 1; kernel (0, 2).intensity = 0; + kernel(0, 0).intensity = -1; + kernel(0, 1).intensity = 1; + kernel(0, 2).intensity = 0; } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::setKernelType (KERNEL_ENUM kernel_type) +template +void +pcl::kernel::setKernelType(KERNEL_ENUM kernel_type) { kernel_type_ = kernel_type; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::setKernelSize (int kernel_size) +template +void +pcl::kernel::setKernelSize(int kernel_size) { kernel_size_ = kernel_size; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::kernel::setKernelSigma (float kernel_sigma) +template +void +pcl::kernel::setKernelSigma(float kernel_sigma) { sigma_ = kernel_sigma; } - #endif diff --git a/2d/include/pcl/2d/impl/keypoint.hpp b/2d/include/pcl/2d/impl/keypoint.hpp index 2a99ab56..fd8235d7 100644 --- a/2d/include/pcl/2d/impl/keypoint.hpp +++ b/2d/include/pcl/2d/impl/keypoint.hpp @@ -42,53 +42,57 @@ #ifndef PCL_2D_KEYPOINT_HPP_ #define PCL_2D_KEYPOINT_HPP_ -#include -#include #include +#include +#include ////////////////////////////////////////////////////////////////////////////// void -pcl::keypoint::harrisCorner (ImageType &output, ImageType &input, const float sigma_d, const float sigma_i, const float alpha, const float thresh){ +pcl::keypoint::harrisCorner(ImageType& output, + ImageType& input, + const float sigma_d, + const float sigma_i, + const float alpha, + const float thresh) +{ /*creating the gaussian kernels*/ ImageType kernel_d; ImageType kernel_i; - conv_2d.gaussianKernel (5, sigma_d, kernel_d); - conv_2d.gaussianKernel (5, sigma_i, kernel_i); + conv_2d.gaussianKernel(5, sigma_d, kernel_d); + conv_2d.gaussianKernel(5, sigma_i, kernel_i); /*scaling the image with differentiation scale*/ ImageType smoothed_image; - conv_2d.convolve (smoothed_image, kernel_d, input); + conv_2d.convolve(smoothed_image, kernel_d, input); /*image derivatives*/ ImageType I_x, I_y; - edge_detection.ComputeDerivativeXCentral (I_x, smoothed_image); - edge_detection.ComputeDerivativeYCentral (I_y, smoothed_image); + edge_detection.ComputeDerivativeXCentral(I_x, smoothed_image); + edge_detection.ComputeDerivativeYCentral(I_y, smoothed_image); /*second moment matrix*/ ImageType I_x2, I_y2, I_xI_y; - imageElementMultiply (I_x2, I_x, I_x); - imageElementMultiply (I_y2, I_y, I_y); - imageElementMultiply (I_xI_y, I_x, I_y); + imageElementMultiply(I_x2, I_x, I_x); + imageElementMultiply(I_y2, I_y, I_y); + imageElementMultiply(I_xI_y, I_x, I_y); /*scaling second moment matrix with integration scale*/ ImageType M00, M10, M11; - conv_2d.convolve (M00, kernel_i, I_x2); - conv_2d.convolve (M10, kernel_i, I_xI_y); - conv_2d.convolve (M11, kernel_i, I_y2); + conv_2d.convolve(M00, kernel_i, I_x2); + conv_2d.convolve(M10, kernel_i, I_xI_y); + conv_2d.convolve(M11, kernel_i, I_y2); /*harris function*/ - const size_t height = input.size (); - const size_t width = input[0].size (); - output.resize (height); - for (size_t i = 0; i < height; i++) - { - output[i].resize (width); - for (size_t j = 0; j < width; j++) - { - output[i][j] = M00[i][j] * M11[i][j] - (M10[i][j] * M10[i][j]) - alpha * ((M00[i][j] + M11[i][j]) * (M00[i][j] + M11[i][j])); - if (thresh != 0) - { + const std::size_t height = input.size(); + const std::size_t width = input[0].size(); + output.resize(height); + for (std::size_t i = 0; i < height; i++) { + output[i].resize(width); + for (std::size_t j = 0; j < width; j++) { + output[i][j] = M00[i][j] * M11[i][j] - (M10[i][j] * M10[i][j]) - + alpha * ((M00[i][j] + M11[i][j]) * (M00[i][j] + M11[i][j])); + if (thresh != 0) { if (output[i][j] < thresh) output[i][j] = 0; else @@ -98,13 +102,12 @@ pcl::keypoint::harrisCorner (ImageType &output, ImageType &input, const float si } /*local maxima*/ - for (size_t i = 1; i < height - 1; i++) - { - for (size_t j = 1; j < width - 1; j++) - { - if (output[i][j] > output[i - 1][j - 1] && output[i][j] > output[i - 1][j] && output[i][j] > output[i - 1][j + 1] && - output[i][j] > output[i][j - 1] && output[i][j] > output[i][j + 1] && - output[i][j] > output[i + 1][j - 1] && output[i][j] > output[i + 1][j] && output[i][j] > output[i + 1][j + 1]) + for (std::size_t i = 1; i < height - 1; i++) { + for (std::size_t j = 1; j < width - 1; j++) { + if (output[i][j] > output[i - 1][j - 1] && output[i][j] > output[i - 1][j] && + output[i][j] > output[i - 1][j + 1] && output[i][j] > output[i][j - 1] && + output[i][j] > output[i][j + 1] && output[i][j] > output[i + 1][j - 1] && + output[i][j] > output[i + 1][j] && output[i][j] > output[i + 1][j + 1]) ; else output[i][j] = 0; @@ -114,56 +117,57 @@ pcl::keypoint::harrisCorner (ImageType &output, ImageType &input, const float si ////////////////////////////////////////////////////////////////////////////// void -pcl::keypoint::hessianBlob (ImageType &output, ImageType &input, const float sigma, bool SCALED){ +pcl::keypoint::hessianBlob(ImageType& output, + ImageType& input, + const float sigma, + bool SCALED) +{ /*creating the gaussian kernels*/ ImageType kernel, cornerness; - conv_2d.gaussianKernel (5, sigma, kernel); + conv_2d.gaussianKernel(5, sigma, kernel); /*scaling the image with differentiation scale*/ ImageType smoothed_image; - conv_2d.convolve (smoothed_image, kernel, input); + conv_2d.convolve(smoothed_image, kernel, input); /*image derivatives*/ ImageType I_x, I_y; - edge_detection.ComputeDerivativeXCentral (I_x, smoothed_image); - edge_detection.ComputeDerivativeYCentral (I_y, smoothed_image); + edge_detection.ComputeDerivativeXCentral(I_x, smoothed_image); + edge_detection.ComputeDerivativeYCentral(I_y, smoothed_image); /*second moment matrix*/ ImageType I_xx, I_yy, I_xy; - edge_detection.ComputeDerivativeXCentral (I_xx, I_x); - edge_detection.ComputeDerivativeYCentral (I_xy, I_x); - edge_detection.ComputeDerivativeYCentral (I_yy, I_y); + edge_detection.ComputeDerivativeXCentral(I_xx, I_x); + edge_detection.ComputeDerivativeYCentral(I_xy, I_x); + edge_detection.ComputeDerivativeYCentral(I_yy, I_y); /*Determinant of Hessian*/ - const size_t height = input.size (); - const size_t width = input[0].size (); + const std::size_t height = input.size(); + const std::size_t width = input[0].size(); float min = std::numeric_limits::max(); float max = std::numeric_limits::min(); - cornerness.resize (height); - for (size_t i = 0; i < height; i++) - { - cornerness[i].resize (width); - for (size_t j = 0; j < width; j++) - { - cornerness[i][j] = sigma*sigma*(I_xx[i][j]+I_yy[i][j]-I_xy[i][j]*I_xy[i][j]); - if(SCALED){ - if(cornerness[i][j] < min) + cornerness.resize(height); + for (std::size_t i = 0; i < height; i++) { + cornerness[i].resize(width); + for (std::size_t j = 0; j < width; j++) { + cornerness[i][j] = + sigma * sigma * (I_xx[i][j] + I_yy[i][j] - I_xy[i][j] * I_xy[i][j]); + if (SCALED) { + if (cornerness[i][j] < min) min = cornerness[i][j]; - if(cornerness[i][j] > max) + if (cornerness[i][j] > max) max = cornerness[i][j]; } } /*local maxima*/ - output.resize (height); - output[0].resize (width); - output[height-1].resize (width); - for (size_t i = 1; i < height - 1; i++) - { - output[i].resize (width); - for (size_t j = 1; j < width - 1; j++) - { - if(SCALED) - output[i][j] = ((cornerness[i][j]-min)/(max-min)); + output.resize(height); + output[0].resize(width); + output[height - 1].resize(width); + for (std::size_t i = 1; i < height - 1; i++) { + output[i].resize(width); + for (std::size_t j = 1; j < width - 1; j++) { + if (SCALED) + output[i][j] = ((cornerness[i][j] - min) / (max - min)); else output[i][j] = cornerness[i][j]; } @@ -173,54 +177,61 @@ pcl::keypoint::hessianBlob (ImageType &output, ImageType &input, const float sig ////////////////////////////////////////////////////////////////////////////// void -pcl::keypoint::hessianBlob (ImageType &output, ImageType &input, const float start_scale, const float scaling_factor, const int num_scales){ - const size_t height = input.size(); - const size_t width = input[0].size(); +pcl::keypoint::hessianBlob(ImageType& output, + ImageType& input, + const float start_scale, + const float scaling_factor, + const int num_scales) +{ + const std::size_t height = input.size(); + const std::size_t width = input[0].size(); const int local_search_radius = 1; float scale = start_scale; std::vector cornerness; cornerness.resize(num_scales); - for(int i = 0;i < num_scales;i++){ + for (int i = 0; i < num_scales; i++) { hessianBlob(cornerness[i], input, scale, false); scale *= scaling_factor; } bool non_max_flag = false; float scale_max, local_max; - for(size_t i = 0;i < height;i++){ - for(size_t j = 0;j < width;j++){ + for (std::size_t i = 0; i < height; i++) { + for (std::size_t j = 0; j < width; j++) { scale_max = std::numeric_limits::min(); /*default output in case of no blob at the current point is 0*/ output[i][j] = 0; - for(int k = 0;k < num_scales;k++){ + for (int k = 0; k < num_scales; k++) { /*check if the current point (k,i,j) is a maximum in the defined search radius*/ non_max_flag = false; local_max = cornerness[k][i][j]; - for(int n = -local_search_radius; n <= local_search_radius;n++){ - if(n+k < 0 || n+k >= num_scales) + for (int n = -local_search_radius; n <= local_search_radius; n++) { + if (n + k < 0 || n + k >= num_scales) continue; - for(int l = -local_search_radius;l <= local_search_radius;l++){ - if(l+i < 0 || l+i >= height) + for (int l = -local_search_radius; l <= local_search_radius; l++) { + if (l + i < 0 || l + i >= height) continue; - for(int m = -local_search_radius; m <= local_search_radius;m++){ - if(m+j < 0 || m+j >= width) + for (int m = -local_search_radius; m <= local_search_radius; m++) { + if (m + j < 0 || m + j >= width) continue; - if(cornerness[n+k][l+i][m+j] > local_max){ + if (cornerness[n + k][l + i][m + j] > local_max) { non_max_flag = true; break; } } - if(non_max_flag) + if (non_max_flag) break; } - if(non_max_flag) + if (non_max_flag) break; } - /*if the current point is a point of local maximum, check if it is a maximum point across scales*/ - if(!non_max_flag){ - if(cornerness[k][i][j] > scale_max){ + /*if the current point is a point of local maximum, check if it is a maximum + * point across scales*/ + if (!non_max_flag) { + if (cornerness[k][i][j] > scale_max) { scale_max = cornerness[k][i][j]; - /*output indicates the scale at which the blob is found at the current location in the image*/ - output[i][i] = start_scale*pow(scaling_factor, k); + /*output indicates the scale at which the blob is found at the current + * location in the image*/ + output[i][i] = start_scale * pow(scaling_factor, k); } } } @@ -230,18 +241,19 @@ pcl::keypoint::hessianBlob (ImageType &output, ImageType &input, const float sta ////////////////////////////////////////////////////////////////////////////// void -pcl::keypoint::imageElementMultiply (ImageType &output, ImageType &input1, ImageType &input2){ - const size_t height = input1.size (); - const size_t width = input1[0].size (); - output.resize (height); - for (size_t i = 0; i < height; i++) - { - output[i].resize (width); - for (size_t j = 0; j < width; j++) - { +pcl::keypoint::imageElementMultiply(ImageType& output, + ImageType& input1, + ImageType& input2) +{ + const std::size_t height = input1.size(); + const std::size_t width = input1[0].size(); + output.resize(height); + for (std::size_t i = 0; i < height; i++) { + output[i].resize(width); + for (std::size_t j = 0; j < width; j++) { output[i][j] = input1[i][j] * input2[i][j]; } } } -#endif // PCL_2D_KEYPOINT_HPP_ +#endif // PCL_2D_KEYPOINT_HPP_ diff --git a/2d/include/pcl/2d/impl/morphology.hpp b/2d/include/pcl/2d/impl/morphology.hpp index 39a548bc..4def02de 100644 --- a/2d/include/pcl/2d/impl/morphology.hpp +++ b/2d/include/pcl/2d/impl/morphology.hpp @@ -40,8 +40,9 @@ ////////////////////////////////////////////////////////////////////////////// // Assumes input, kernel and output images have 0's and 1's only -template void -pcl::Morphology::erosionBinary (pcl::PointCloud &output) +template +void +pcl::Morphology::erosionBinary(pcl::PointCloud& output) { const int height = input_->height; const int width = input_->width; @@ -51,52 +52,49 @@ pcl::Morphology::erosionBinary (pcl::PointCloud &output) output.width = width; output.height = height; - output.resize (width * height); + output.resize(width * height); - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { // Operation done only at 1's - if ((*input_)(j, i).intensity == 0) - { - output (j, i).intensity = 0; + if ((*input_)(j, i).intensity == 0) { + output(j, i).intensity = 0; continue; } mismatch_flag = false; - for (int k = 0; k < kernel_height; k++) - { + for (int k = 0; k < kernel_height; k++) { if (mismatch_flag) break; - for (int l = 0; l < kernel_width; l++) - { + for (int l = 0; l < kernel_width; l++) { // We only check for 1's in the kernel if ((*structuring_element_)(l, k).intensity == 0) continue; - if ((i + k - kernel_height / 2) < 0 || (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || (j + l - kernel_width / 2) >= width) - { + if ((i + k - kernel_height / 2) < 0 || + (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || + (j + l - kernel_width / 2) >= width) { continue; } - // If one of the elements of the kernel and image don't match, + // If one of the elements of the kernel and image don't match, // the output image is 0. So, move to the next point. - if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity != 1) - { - output (j, i).intensity = 0; + if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2) + .intensity != 1) { + output(j, i).intensity = 0; mismatch_flag = true; break; } } } // Assign value according to mismatch flag - output (j, i).intensity = (mismatch_flag) ? 0 : 1; + output(j, i).intensity = (mismatch_flag) ? 0 : 1; } } } ////////////////////////////////////////////////////////////////////////////// // Assumes input, kernel and output images have 0's and 1's only -template void -pcl::Morphology::dilationBinary (pcl::PointCloud &output) +template +void +pcl::Morphology::dilationBinary(pcl::PointCloud& output) { const int height = input_->height; const int width = input_->width; @@ -106,109 +104,109 @@ pcl::Morphology::dilationBinary (pcl::PointCloud &output) output.width = width; output.height = height; - output.resize (width * height); + output.resize(width * height); - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { match_flag = false; - for (int k = 0; k < kernel_height; k++) - { + for (int k = 0; k < kernel_height; k++) { if (match_flag) break; - for (int l = 0; l < kernel_width; l++) - { + for (int l = 0; l < kernel_width; l++) { // We only check for 1's in the kernel if ((*structuring_element_)(l, k).intensity == 0) continue; - if ((i + k - kernel_height / 2) < 0 || (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || (j + l - kernel_width / 2) >= height) - { + if ((i + k - kernel_height / 2) < 0 || + (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || + (j + l - kernel_width / 2) >= height) { continue; } - // If any position where kernel is 1 and image is also one is detected, + // If any position where kernel is 1 and image is also one is detected, // matching occurs - if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity == 1) - { + if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2) + .intensity == 1) { match_flag = true; break; } } } // Assign value according to match flag - output (j, i).intensity = (match_flag) ? 1 : 0; + output(j, i).intensity = (match_flag) ? 1 : 0; } } } ////////////////////////////////////////////////////////////////////////////// // Assumes input, kernel and output images have 0's and 1's only -template void -pcl::Morphology::openingBinary (pcl::PointCloud &output) +template +void +pcl::Morphology::openingBinary(pcl::PointCloud& output) { - PointCloudInPtr intermediate_output (new PointCloudIn); - erosionBinary (*intermediate_output); - this->setInputCloud (intermediate_output); - dilationBinary (output); + PointCloudInPtr intermediate_output(new PointCloudIn); + erosionBinary(*intermediate_output); + this->setInputCloud(intermediate_output); + dilationBinary(output); } ////////////////////////////////////////////////////////////////////////////// // Assumes input, kernel and output images have 0's and 1's only -template void -pcl::Morphology::closingBinary (pcl::PointCloud &output) +template +void +pcl::Morphology::closingBinary(pcl::PointCloud& output) { - PointCloudInPtr intermediate_output (new PointCloudIn); - dilationBinary (*intermediate_output); - this->setInputCloud (intermediate_output); - erosionBinary (output); + PointCloudInPtr intermediate_output(new PointCloudIn); + dilationBinary(*intermediate_output); + this->setInputCloud(intermediate_output); + erosionBinary(output); } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::erosionGray (pcl::PointCloud &output) +template +void +pcl::Morphology::erosionGray(pcl::PointCloud& output) { const int height = input_->height; const int width = input_->width; const int kernel_height = structuring_element_->height; const int kernel_width = structuring_element_->width; float min; - output.resize (width * height); + output.resize(width * height); output.width = width; output.height = height; - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { min = -1; - for (int k = 0; k < kernel_height; k++) - { - for (int l = 0; l < kernel_width; l++) - { + for (int k = 0; k < kernel_height; k++) { + for (int l = 0; l < kernel_width; l++) { // We only check for 1's in the kernel if ((*structuring_element_)(l, k).intensity == 0) continue; - if ((i + k - kernel_height / 2) < 0 || (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || (j + l - kernel_width / 2) >= width) - { + if ((i + k - kernel_height / 2) < 0 || + (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || + (j + l - kernel_width / 2) >= width) { continue; } - // If one of the elements of the kernel and image don't match, + // If one of the elements of the kernel and image don't match, // the output image is 0. So, move to the next point. - if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity < min || min == -1) - { - min = (*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity; + if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity < + min || + min == -1) { + min = (*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2) + .intensity; } } } // Assign value according to mismatch flag - output (j, i).intensity = min; + output(j, i).intensity = min; } } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::dilationGray (pcl::PointCloud &output) +template +void +pcl::Morphology::dilationGray(pcl::PointCloud& output) { const int height = input_->height; const int width = input_->width; @@ -216,75 +214,75 @@ pcl::Morphology::dilationGray (pcl::PointCloud &output) const int kernel_width = structuring_element_->width; float max; - output.resize (width * height); + output.resize(width * height); output.width = width; output.height = height; - for (int i = 0; i < height; i++) - { - for (int j = 0; j < width; j++) - { + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { max = -1; - for (int k = 0; k < kernel_height; k++) - { - for (int l = 0; l < kernel_width; l++) - { + for (int k = 0; k < kernel_height; k++) { + for (int l = 0; l < kernel_width; l++) { // We only check for 1's in the kernel if ((*structuring_element_)(l, k).intensity == 0) continue; - if ((i + k - kernel_height / 2) < 0 || (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || (j + l - kernel_width / 2) >= width) - { + if ((i + k - kernel_height / 2) < 0 || + (i + k - kernel_height / 2) >= height || (j + l - kernel_width / 2) < 0 || + (j + l - kernel_width / 2) >= width) { continue; } - // If one of the elements of the kernel and image don't match, + // If one of the elements of the kernel and image don't match, // the output image is 0. So, move to the next point. - if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity > max || max == -1) - { - max = (*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity; + if ((*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2).intensity > + max || + max == -1) { + max = (*input_)(j + l - kernel_width / 2, i + k - kernel_height / 2) + .intensity; } } } // Assign value according to mismatch flag - output (j, i).intensity = max; + output(j, i).intensity = max; } } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::openingGray (pcl::PointCloud &output) +template +void +pcl::Morphology::openingGray(pcl::PointCloud& output) { - PointCloudInPtr intermediate_output (new PointCloudIn); - erosionGray (*intermediate_output); - this->setInputCloud (intermediate_output); - dilationGray (output); + PointCloudInPtr intermediate_output(new PointCloudIn); + erosionGray(*intermediate_output); + this->setInputCloud(intermediate_output); + dilationGray(output); } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::closingGray (pcl::PointCloud &output) +template +void +pcl::Morphology::closingGray(pcl::PointCloud& output) { - PointCloudInPtr intermediate_output (new PointCloudIn); - dilationGray (*intermediate_output); - this->setInputCloud (intermediate_output); - erosionGray (output); + PointCloudInPtr intermediate_output(new PointCloudIn); + dilationGray(*intermediate_output); + this->setInputCloud(intermediate_output); + erosionGray(output); } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::subtractionBinary ( - pcl::PointCloud &output, - const pcl::PointCloud &input1, - const pcl::PointCloud &input2) +template +void +pcl::Morphology::subtractionBinary(pcl::PointCloud& output, + const pcl::PointCloud& input1, + const pcl::PointCloud& input2) { const int height = (input1.height < input2.height) ? input1.height : input2.height; const int width = (input1.width < input2.width) ? input1.width : input2.width; output.width = width; output.height = height; - output.resize (height * width); + output.resize(height * width); - for (size_t i = 0; i < output.size (); ++i) - { + for (std::size_t i = 0; i < output.size(); ++i) { if (input1[i].intensity == 1 && input2[i].intensity == 0) output[i].intensity = 1; else @@ -293,20 +291,19 @@ pcl::Morphology::subtractionBinary ( } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::unionBinary ( - pcl::PointCloud &output, - const pcl::PointCloud &input1, - const pcl::PointCloud &input2) +template +void +pcl::Morphology::unionBinary(pcl::PointCloud& output, + const pcl::PointCloud& input1, + const pcl::PointCloud& input2) { const int height = (input1.height < input2.height) ? input1.height : input2.height; const int width = (input1.width < input2.width) ? input1.width : input2.width; output.width = width; output.height = height; - output.resize (height * width); + output.resize(height * width); - for (size_t i = 0; i < output.size (); ++i) - { + for (std::size_t i = 0; i < output.size(); ++i) { if (input1[i].intensity == 1 || input2[i].intensity == 1) output[i].intensity = 1; else @@ -315,20 +312,19 @@ pcl::Morphology::unionBinary ( } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::intersectionBinary ( - pcl::PointCloud &output, - const pcl::PointCloud &input1, - const pcl::PointCloud &input2) +template +void +pcl::Morphology::intersectionBinary(pcl::PointCloud& output, + const pcl::PointCloud& input1, + const pcl::PointCloud& input2) { const int height = (input1.height < input2.height) ? input1.height : input2.height; const int width = (input1.width < input2.width) ? input1.width : input2.width; output.width = width; output.height = height; - output.resize (height * width); + output.resize(height * width); - for (size_t i = 0; i < output.size (); ++i) - { + for (std::size_t i = 0; i < output.size(); ++i) { if (input1[i].intensity == 1 && input2[i].intensity == 1) output[i].intensity = 1; else @@ -337,44 +333,47 @@ pcl::Morphology::intersectionBinary ( } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::structuringElementCircular ( - pcl::PointCloud &kernel, const int radius) +template +void +pcl::Morphology::structuringElementCircular(pcl::PointCloud& kernel, + const int radius) { const int dim = 2 * radius; kernel.height = dim; kernel.width = dim; - kernel.resize (dim * dim); + kernel.resize(dim * dim); - for (int i = 0; i < dim; i++) - { - for (int j = 0; j < dim; j++) - { + for (int i = 0; i < dim; i++) { + for (int j = 0; j < dim; j++) { if (((i - radius) * (i - radius) + (j - radius) * (j - radius)) < radius * radius) - kernel (j, i).intensity = 1; + kernel(j, i).intensity = 1; else - kernel (j, i).intensity = 0; + kernel(j, i).intensity = 0; } } } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::structuringElementRectangle ( - pcl::PointCloud &kernel, const int height, const int width) +template +void +pcl::Morphology::structuringElementRectangle(pcl::PointCloud& kernel, + const int height, + const int width) { kernel.height = height; kernel.width = width; - kernel.resize (height * width); - for (size_t i = 0; i < kernel.size (); ++i) + kernel.resize(height * width); + for (std::size_t i = 0; i < kernel.size(); ++i) kernel[i].intensity = 1; } ////////////////////////////////////////////////////////////////////////////// -template void -pcl::Morphology::setStructuringElement (const PointCloudInPtr &structuring_element) +template +void +pcl::Morphology::setStructuringElement( + const PointCloudInPtr& structuring_element) { structuring_element_ = structuring_element; } -#endif // PCL_2D_MORPHOLOGY_HPP_ +#endif // PCL_2D_MORPHOLOGY_HPP_ diff --git a/2d/include/pcl/2d/kernel.h b/2d/include/pcl/2d/kernel.h index e440933b..499d3a38 100644 --- a/2d/include/pcl/2d/kernel.h +++ b/2d/include/pcl/2d/kernel.h @@ -35,210 +35,205 @@ * */ -#ifndef PCL_2D_KERNEL_H_ -#define PCL_2D_KERNEL_H_ +#pragma once + #include #include -namespace pcl -{ - template - class kernel - { - public: - - /** - * enumerates the different types of kernels available. - */ - enum KERNEL_ENUM - { - SOBEL_X, //!< SOBEL_X - SOBEL_Y, //!< SOBEL_Y - PREWITT_X, //!< PREWITT_X - PREWITT_Y, //!< PREWITT_Y - ROBERTS_X, //!< ROBERTS_X - ROBERTS_Y, //!< ROBERTS_Y - LOG, //!< LOG - DERIVATIVE_CENTRAL_X, //!< DERIVATIVE_CENTRAL_X - DERIVATIVE_FORWARD_X, //!< DERIVATIVE_FORWARD_X - DERIVATIVE_BACKWARD_X,//!< DERIVATIVE_BACKWARD_X - DERIVATIVE_CENTRAL_Y, //!< DERIVATIVE_CENTRAL_Y - DERIVATIVE_FORWARD_Y, //!< DERIVATIVE_FORWARD_Y - DERIVATIVE_BACKWARD_Y,//!< DERIVATIVE_BACKWARD_Y - GAUSSIAN //!< GAUSSIAN - }; - - int kernel_size_; - float sigma_; - KERNEL_ENUM kernel_type_; - - kernel () : - kernel_size_ (3), - sigma_ (1.0), - kernel_type_ (GAUSSIAN) - { - - } - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * Helper function which returns the kernel selected by the kernel_type_ enum - */ - void fetchKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * Gaussian kernel with size (kernel_size_ x kernel_size_) and variance sigma_ - */ - - void gaussianKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * Laplacian of Gaussian kernel with size (kernel_size_ x kernel_size_) and variance sigma_ - */ - - void loGKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * 3x3 Sobel kernel in the X direction - */ - - void sobelKernelX (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * 3x3 Prewitt kernel in the X direction - */ - - void prewittKernelX (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * 2x2 Roberts kernel in the X direction - */ - - void robertsKernelX (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * 3x3 Sobel kernel in the Y direction - */ - - void sobelKernelY (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * 3x3 Prewitt kernel in the Y direction - */ - - void prewittKernelY (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * 2x2 Roberts kernel in the Y direction - */ - - void robertsKernelY (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * kernel [-1 0 1] - */ - - void derivativeXCentralKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * kernel [-1 0 1]' - */ - - void derivativeYCentralKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * kernel [0 -1 1] - */ - - void derivativeXForwardKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * kernel [0 -1 1]' - */ - - void derivativeYForwardKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * kernel [-1 1 0] - */ - - void derivativeXBackwardKernel (pcl::PointCloud &kernel); - - /** - * - * @param kernel Kernel point cloud passed by reference - * - * kernel [-1 1 0]' - */ - - void derivativeYBackwardKernel (PointCloud &kernel); - - /** - * - * @param kernel_type enum indicating the kernel type wanted - * - * select the kernel type. - */ - void setKernelType (KERNEL_ENUM kernel_type); - - /** - * - * @param kernel_size kernel of size kernel_size x kernel_size is created(LoG and Gaussian only) - * - * Setter function for kernel_size_ - */ - void setKernelSize (int kernel_size); - - /** - * - * @param kernel_sigma variance of the Gaussian or LoG kernels. - * - * Setter function for kernel_sigma_ - */ - void setKernelSigma (float kernel_sigma); + +namespace pcl { + +template +class kernel { +public: + /// Different types of kernels available. + enum KERNEL_ENUM { + SOBEL_X, //!< SOBEL_X + SOBEL_Y, //!< SOBEL_Y + PREWITT_X, //!< PREWITT_X + PREWITT_Y, //!< PREWITT_Y + ROBERTS_X, //!< ROBERTS_X + ROBERTS_Y, //!< ROBERTS_Y + LOG, //!< LOG + DERIVATIVE_CENTRAL_X, //!< DERIVATIVE_CENTRAL_X + DERIVATIVE_FORWARD_X, //!< DERIVATIVE_FORWARD_X + DERIVATIVE_BACKWARD_X, //!< DERIVATIVE_BACKWARD_X + DERIVATIVE_CENTRAL_Y, //!< DERIVATIVE_CENTRAL_Y + DERIVATIVE_FORWARD_Y, //!< DERIVATIVE_FORWARD_Y + DERIVATIVE_BACKWARD_Y, //!< DERIVATIVE_BACKWARD_Y + GAUSSIAN //!< GAUSSIAN }; -} -#include + int kernel_size_; + float sigma_; + KERNEL_ENUM kernel_type_; + + kernel() : kernel_size_(3), sigma_(1.0), kernel_type_(GAUSSIAN) {} + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * Helper function which returns the kernel selected by the kernel_type_ enum + */ + void + fetchKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * Gaussian kernel with size (kernel_size_ x kernel_size_) and variance sigma_ + */ + void + gaussianKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * Laplacian of Gaussian kernel with size (kernel_size_ x kernel_size_) and variance + * sigma_ + */ + void + loGKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * 3x3 Sobel kernel in the X direction + */ + void + sobelKernelX(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * 3x3 Prewitt kernel in the X direction + */ + void + prewittKernelX(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * 2x2 Roberts kernel in the X direction + */ + void + robertsKernelX(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * 3x3 Sobel kernel in the Y direction + */ + void + sobelKernelY(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * 3x3 Prewitt kernel in the Y direction + */ + void + prewittKernelY(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * 2x2 Roberts kernel in the Y direction + */ + void + robertsKernelY(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * kernel [-1 0 1] + */ + void + derivativeXCentralKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * kernel [-1 0 1]' + */ + void + derivativeYCentralKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * kernel [0 -1 1] + */ + void + derivativeXForwardKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * kernel [0 -1 1]' + */ + void + derivativeYForwardKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * kernel [-1 1 0] + */ + void + derivativeXBackwardKernel(pcl::PointCloud& kernel); + + /** + * + * @param kernel Kernel point cloud passed by reference + * + * kernel [-1 1 0]' + */ + void + derivativeYBackwardKernel(PointCloud& kernel); + + /** + * + * @param kernel_type enum indicating the kernel type wanted + * + * select the kernel type. + */ + void + setKernelType(KERNEL_ENUM kernel_type); + + /** + * + * @param kernel_size kernel of size kernel_size x kernel_size is created(LoG and + * Gaussian only) + * + * Setter function for kernel_size_ + */ + void + setKernelSize(int kernel_size); + + /** + * + * @param kernel_sigma variance of the Gaussian or LoG kernels. + * + * Setter function for kernel_sigma_ + */ + void + setKernelSigma(float kernel_sigma); +}; + +} // namespace pcl -#endif // PCL_2D_KERNEL_H_ +#include diff --git a/2d/include/pcl/2d/keypoint.h b/2d/include/pcl/2d/keypoint.h index 677e52e6..a7c454d9 100644 --- a/2d/include/pcl/2d/keypoint.h +++ b/2d/include/pcl/2d/keypoint.h @@ -39,37 +39,42 @@ * Author: somani */ -#ifndef PCL_2D_KEYPOINT_H_ -#define PCL_2D_KEYPOINT_H_ +#pragma once #include -namespace pcl -{ - class Keypoint - { - private: - Edge edge_detection; - Convolution conv_2d; - public: - Keypoint () - { - } - - void - harrisCorner (ImageType &output, ImageType &input, const float sigma_d, const float sigma_i, const float alpha, const float thresh); - - void - hessianBlob (ImageType &output, ImageType &input, const float sigma, bool SCALE); - - void - hessianBlob (ImageType &output, ImageType &input, const float start_scale, const float scaling_factor, const int num_scales); +namespace pcl { - void - imageElementMultiply (ImageType &output, ImageType &input1, ImageType &input2); - }; -} +class Keypoint { +private: + Edge edge_detection; + Convolution conv_2d; -#include +public: + Keypoint() {} + + void + harrisCorner(ImageType& output, + ImageType& input, + const float sigma_d, + const float sigma_i, + const float alpha, + const float thresh); + + void + hessianBlob(ImageType& output, ImageType& input, const float sigma, bool SCALE); + + void + hessianBlob(ImageType& output, + ImageType& input, + const float start_scale, + const float scaling_factor, + const int num_scales); -#endif // PCL_2D_KEYPOINT_H_ + void + imageElementMultiply(ImageType& output, ImageType& input1, ImageType& input2); +}; + +} // namespace pcl + +#include diff --git a/2d/include/pcl/2d/morphology.h b/2d/include/pcl/2d/morphology.h index a3847b45..b4f95639 100644 --- a/2d/include/pcl/2d/morphology.h +++ b/2d/include/pcl/2d/morphology.h @@ -35,166 +35,172 @@ * */ -#ifndef PCL_2D_MORPHOLOGY_H_ -#define PCL_2D_MORPHOLOGY_H_ +#pragma once #include -namespace pcl -{ - template - class Morphology : public PCLBase - { - private: - typedef typename pcl::PointCloud PointCloudIn; - typedef typename PointCloudIn::Ptr PointCloudInPtr; - - PointCloudInPtr structuring_element_; - - public: - using PCLBase::input_; - - Morphology () {} - - /** \brief This function performs erosion followed by dilation. - * It is useful for removing noise in the form of small blobs and patches. - * \param[out] output Output point cloud passed by reference - */ - void - openingBinary (pcl::PointCloud &output); - - /** \brief This function performs dilation followed by erosion. - * It is useful for filling up (holes/cracks/small discontinuities) in a binary - * segmented region - * \param[out] output Output point cloud passed by reference - */ - void - closingBinary (pcl::PointCloud &output); - - /** \brief Binary dilation is similar to a logical disjunction of sets. - * At each pixel having value 1, if for all pixels in the structuring element having value 1, the corresponding - * pixels in the input image are also 1, the center pixel is set to 1. Otherwise, it is set to 0. - * \param[out] output Output point cloud passed by reference - */ - void - erosionBinary (pcl::PointCloud &output); - - /** \brief Binary erosion is similar to a logical addition of sets. - * At each pixel having value 1, if at least one pixel in the structuring element is 1 and the corresponding point - * in the input image is 1, the center pixel is set to 1. Otherwise, it is set to 0. - * \param[out] output Output point cloud passed by reference - */ - void - dilationBinary (pcl::PointCloud &output); - - /** \brief Grayscale erosion followed by dilation. - * This is used to remove small bright artifacts from the image. Large bright objects are relatively undisturbed. - * \param[out] output Output point cloud passed by reference - */ - void - openingGray (pcl::PointCloud &output); - - /** \brief Grayscale dilation followed by erosion. - * This is used to remove small dark artifacts from the image. Bright features or large dark features are relatively undisturbed. - * \param[out] output Output point cloud passed by reference - */ - void - closingGray (pcl::PointCloud &output); - - /** \brief Takes the min of the pixels where kernel is 1 - * \param[out] output Output point cloud passed by reference - */ - void - erosionGray (pcl::PointCloud &output); - - /** \brief Takes the max of the pixels where kernel is 1 - * \param[out] output Output point cloud passed by reference - */ - void - dilationGray (pcl::PointCloud &output); - - /** \brief Set operation - * output = input1 - input2 - * \param[out] output Output point cloud passed by reference - * \param[in] input1 - * \param[in] input2 - */ - void - subtractionBinary (pcl::PointCloud &output, - const pcl::PointCloud &input1, - const pcl::PointCloud &input2); - - /** \brief Set operation - * \f$output = input1 \cup input2\f$ - * \param[out] output Output point cloud passed by reference - * \param[in] input1 - * \param[in] input2 - */ - void - unionBinary (pcl::PointCloud &output, - const pcl::PointCloud &input1, - const pcl::PointCloud &input2); - - /** \brief Set operation \f$ output = input1 \cap input2 \f$ - * \param[out] output Output point cloud passed by reference - * \param[in] input1 - * \param[in] input2 - */ - void - intersectionBinary (pcl::PointCloud &output, - const pcl::PointCloud &input1, - const pcl::PointCloud &input2); - - /** \brief Creates a circular structing element. The size of the kernel created is 2*radius x 2*radius. - * Center of the structuring element is the center of the circle. - * All values lying on the circle are 1 and the others are 0. - * - * \param[out] kernel structuring element kernel passed by reference - * \param[in] radius Radius of the circular structuring element. - */ - void - structuringElementCircular (pcl::PointCloud &kernel, const int radius); - - /** \brief Creates a rectangular structing element of size height x width. * - * All values are 1. - * - * \param[out] kernel structuring element kernel passed by reference - * \param[in] height height number of rows in the structuring element - * \param[in] width number of columns in the structuring element - * - */ - void - structuringElementRectangle (pcl::PointCloud &kernel, - const int height, const int width); - - enum MORPHOLOGICAL_OPERATOR_TYPE - { - EROSION_GRAY, - DILATION_GRAY, - OPENING_GRAY, - CLOSING_GRAY, - EROSION_BINARY, - DILATION_BINARY, - OPENING_BINARY, - CLOSING_BINARY - }; - - MORPHOLOGICAL_OPERATOR_TYPE operator_type; - - /** - * \param[out] output Output point cloud passed by reference - */ - void - applyMorphologicalOperation (pcl::PointCloud &output); - - /** - * \param[in] structuring_element The structuring element to be used for the morphological operation - */ - void - setStructuringElement (const PointCloudInPtr &structuring_element); +namespace pcl { + +template +class Morphology : public PCLBase { +private: + using PointCloudIn = pcl::PointCloud; + using PointCloudInPtr = typename PointCloudIn::Ptr; + + PointCloudInPtr structuring_element_; + +public: + using PCLBase::input_; + + Morphology() {} + + /** \brief This function performs erosion followed by dilation. + * It is useful for removing noise in the form of small blobs and patches. + * \param[out] output Output point cloud passed by reference + */ + void + openingBinary(pcl::PointCloud& output); + + /** \brief This function performs dilation followed by erosion. + * It is useful for filling up (holes/cracks/small discontinuities) in a binary + * segmented region + * \param[out] output Output point cloud passed by reference + */ + void + closingBinary(pcl::PointCloud& output); + + /** \brief Binary dilation is similar to a logical disjunction of sets. + * At each pixel having value 1, if for all pixels in the structuring element having + * value 1, the corresponding pixels in the input image are also 1, the center pixel + * is set to 1. Otherwise, it is set to 0. + * + * \param[out] output Output point cloud passed by reference + */ + void + erosionBinary(pcl::PointCloud& output); + + /** \brief Binary erosion is similar to a logical addition of sets. + * At each pixel having value 1, if at least one pixel in the structuring element is + * 1 and the corresponding point in the input image is 1, the center pixel is set + * to 1. Otherwise, it is set to 0. + * + * \param[out] output Output point cloud passed by reference + */ + void + dilationBinary(pcl::PointCloud& output); + + /** \brief Grayscale erosion followed by dilation. + * This is used to remove small bright artifacts from the image. Large bright objects + * are relatively undisturbed. + * + * \param[out] output Output point cloud passed by reference + */ + void + openingGray(pcl::PointCloud& output); + + /** \brief Grayscale dilation followed by erosion. + * This is used to remove small dark artifacts from the image. Bright features or + * large dark features are relatively undisturbed. + * + * \param[out] output Output point cloud passed by reference + */ + void + closingGray(pcl::PointCloud& output); + + /** \brief Takes the min of the pixels where kernel is 1 + * \param[out] output Output point cloud passed by reference + */ + void + erosionGray(pcl::PointCloud& output); + + /** \brief Takes the max of the pixels where kernel is 1 + * \param[out] output Output point cloud passed by reference + */ + void + dilationGray(pcl::PointCloud& output); + + /** \brief Set operation + * output = input1 - input2 + * \param[out] output Output point cloud passed by reference + * \param[in] input1 + * \param[in] input2 + */ + void + subtractionBinary(pcl::PointCloud& output, + const pcl::PointCloud& input1, + const pcl::PointCloud& input2); + + /** \brief Set operation + * \f$output = input1 \cup input2\f$ + * \param[out] output Output point cloud passed by reference + * \param[in] input1 + * \param[in] input2 + */ + void + unionBinary(pcl::PointCloud& output, + const pcl::PointCloud& input1, + const pcl::PointCloud& input2); + + /** \brief Set operation \f$ output = input1 \cap input2 \f$ + * \param[out] output Output point cloud passed by reference + * \param[in] input1 + * \param[in] input2 + */ + void + intersectionBinary(pcl::PointCloud& output, + const pcl::PointCloud& input1, + const pcl::PointCloud& input2); + + /** \brief Creates a circular structing element. The size of the kernel created is + * 2*radius x 2*radius. Center of the structuring element is the center of the circle. + * All values lying on the circle are 1 and the others are 0. + * + * \param[out] kernel structuring element kernel passed by reference + * \param[in] radius Radius of the circular structuring element. + */ + void + structuringElementCircular(pcl::PointCloud& kernel, const int radius); + + /** \brief Creates a rectangular structing element of size height x width. * + * All values are 1. + * + * \param[out] kernel structuring element kernel passed by reference + * \param[in] height height number of rows in the structuring element + * \param[in] width number of columns in the structuring element + * + */ + void + structuringElementRectangle(pcl::PointCloud& kernel, + const int height, + const int width); + + enum MORPHOLOGICAL_OPERATOR_TYPE { + EROSION_GRAY, + DILATION_GRAY, + OPENING_GRAY, + CLOSING_GRAY, + EROSION_BINARY, + DILATION_BINARY, + OPENING_BINARY, + CLOSING_BINARY }; -} -#include + MORPHOLOGICAL_OPERATOR_TYPE operator_type; + + /** + * \param[out] output Output point cloud passed by reference + */ + void + applyMorphologicalOperation(pcl::PointCloud& output); + + /** + * \param[in] structuring_element The structuring element to be used for the + * morphological operation + */ + void + setStructuringElement(const PointCloudInPtr& structuring_element); +}; -#endif // PCL_2D_MORPHOLOGY_H_ +} // namespace pcl + +#include diff --git a/2d/src/examples.cpp b/2d/src/examples.cpp index c90f685c..8135ba58 100644 --- a/2d/src/examples.cpp +++ b/2d/src/examples.cpp @@ -46,24 +46,27 @@ using namespace pcl; -void example_edge () +void +example_edge() { Edge edge; /*dummy clouds*/ - pcl::PointCloud::Ptr input_cloud (new pcl::PointCloud); - pcl::PointCloud::Ptr output_cloud (new pcl::PointCloud); + pcl::PointCloud::Ptr input_cloud( + new pcl::PointCloud); + pcl::PointCloud::Ptr output_cloud( + new pcl::PointCloud); /*example 1*/ edge.output_type_ = Edge::OUTPUT_X_Y; - edge.detectEdgeRoberts (*output_cloud, *input_cloud); + edge.detectEdgeRoberts(*output_cloud, *input_cloud); /*example 2*/ edge.hysteresis_threshold_low_ = 20; edge.hysteresis_threshold_high_ = 80; edge.non_max_suppression_radius_x_ = 3; edge.non_max_suppression_radius_y_ = 3; - edge.detectEdgeCanny (*output_cloud, *input_cloud); + edge.detectEdgeCanny(*output_cloud, *input_cloud); /*example 3*/ edge.detector_kernel_type_ = Edge::PREWITT; @@ -74,61 +77,69 @@ void example_edge () edge.non_max_suppression_radius_x_ = 1; edge.non_max_suppression_radius_y_ = 1; edge.output_type_ = Edge::OUTPUT_X_Y; - edge.detectEdge (*output_cloud, *input_cloud); + edge.detectEdge(*output_cloud, *input_cloud); } -void example_convolution () +void +example_convolution() { Kernel kernel; Convolution convolution; /*dummy clouds*/ - pcl::PointCloud::Ptr input_cloud (new pcl::PointCloud); - pcl::PointCloud::Ptr kernel_cloud (new pcl::PointCloud); - pcl::PointCloud::Ptr output_cloud (new pcl::PointCloud); + pcl::PointCloud::Ptr input_cloud( + new pcl::PointCloud); + pcl::PointCloud::Ptr kernel_cloud( + new pcl::PointCloud); + pcl::PointCloud::Ptr output_cloud( + new pcl::PointCloud); /*example 1 : Gaussian Smoothing*/ kernel.sigma_ = 2.0; kernel.kernel_size_ = 3; - kernel.gaussianKernel (*kernel_cloud); + kernel.gaussianKernel(*kernel_cloud); convolution.kernel_ = *kernel_cloud; - convolution.convolve (*output_cloud, *input_cloud); + convolution.convolve(*output_cloud, *input_cloud); /*example 2 : forward derivative in X direction*/ kernel.kernel_type_ = Kernel::DERIVATIVE_FORWARD_X; - kernel.fetchKernel (*kernel_cloud); + kernel.fetchKernel(*kernel_cloud); convolution.kernel_ = *kernel_cloud; - convolution.convolve (*output_cloud, *input_cloud); + convolution.convolve(*output_cloud, *input_cloud); /*example 3*/ kernel.kernel_type_ = Kernel::DERIVATIVE_FORWARD_X; - kernel.fetchKernel (convolution.kernel_); - convolution.convolve (*output_cloud, *input_cloud); + kernel.fetchKernel(convolution.kernel_); + convolution.convolve(*output_cloud, *input_cloud); } -void example_morphology () +void +example_morphology() { Morphology morphology; /*dummy clouds*/ - pcl::PointCloud::Ptr input_cloud (new pcl::PointCloud); - pcl::PointCloud::Ptr structuring_element_cloud (new pcl::PointCloud); - pcl::PointCloud::Ptr output_cloud (new pcl::PointCloud); + pcl::PointCloud::Ptr input_cloud( + new pcl::PointCloud); + pcl::PointCloud::Ptr structuring_element_cloud( + new pcl::PointCloud); + pcl::PointCloud::Ptr output_cloud( + new pcl::PointCloud); /*example 1 : Gaussian Smoothing*/ - morphology.structuringElementCircular (*structuring_element_cloud, 3); + morphology.structuringElementCircular(*structuring_element_cloud, 3); morphology.structuring_element_ = *structuring_element_cloud; morphology.operator_type_ = Morphology::EROSION_GRAY; - morphology.applyMorphologicalOperation (*output_cloud, *input_cloud); + morphology.applyMorphologicalOperation(*output_cloud, *input_cloud); /*example 2 : forward derivative in X direction*/ - morphology.structuringElementCircular (morphology.structuring_element_, 3); + morphology.structuringElementCircular(morphology.structuring_element_, 3); morphology.operator_type_ = Morphology::EROSION_GRAY; - morphology.applyMorphologicalOperation (*output_cloud, *input_cloud); - + morphology.applyMorphologicalOperation(*output_cloud, *input_cloud); } -int main(char *args, int argv) +int +main(char* args, int argv) { return 0; } diff --git a/CHANGES.md b/CHANGES.md index b0fe4ea6..1700eee6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,408 @@ # ChangeList +## *= 1.10.0 (19.01.2020) =* + +Starting with PCL 1.10, to ensure compatibility with future PCL releases, please +use `pcl::make_shared` and the `Class::Ptr` + `Class::ConstPtr` type-alias +instead of using direct names like `{boost, std}::shared_ptr` or `{boost, +std}::make_shared`. There is also `pcl::shared_ptr` which offers the same +abstraction for non-PCL types. + +### `New Features:` + +*Newly added functionalities.* + +* **[sample_consensus]** Add parallel RANSAC implementation with OpenMP [[#3514](https://github.com/PointCloudLibrary/pcl/pull/3514)] +* **[registration]** Add linear least squares version of symmetric objective function for ICP [[#3390](https://github.com/PointCloudLibrary/pcl/pull/3390)] +* **[common]** Add concatenate operation for `PolygonMesh` [[#3316](https://github.com/PointCloudLibrary/pcl/pull/3316)] +* **[common]** Add `emplace[_back]` to `pcl::PointCloud` [[#3207](https://github.com/PointCloudLibrary/pcl/pull/3207)] +* **[cmake]** Add `format` compilation target that applies `clang-format` to whitelisted modules [[#3188](https://github.com/PointCloudLibrary/pcl/pull/3188)] +* **[common]** Add `pcl::make_shared` that automatically handles aligned allocations [[#3163](https://github.com/PointCloudLibrary/pcl/pull/3163)] +* **[modernization][cmake]** Enable C++ 14 flags [[#2690](https://github.com/PointCloudLibrary/pcl/pull/2690)] +* **[io]** Add RSSDK 2.0 (librealsense2) grabber [[#2214](https://github.com/PointCloudLibrary/pcl/pull/2214)] + +### `Deprecated:` + +*Deprecated code scheduled to be removed after two minor releases.* + +* **[common]** Revert smart pointer type change in `PointCloud` and deprecate `getMapping()` [[#3563](https://github.com/PointCloudLibrary/pcl/pull/3563)] +* **[common]** Deprecate `getFields()` with output parameter in favor of overload with return value [[#3401](https://github.com/PointCloudLibrary/pcl/pull/3401)] +* **[recognition]** Refactor `MaskMap` and deprecate several of its methods [[#3399](https://github.com/PointCloudLibrary/pcl/pull/3399)] +* **[common]** Deprecate `getFieldIndex()`/`getFields()` with first argument as cloud [[#3365](https://github.com/PointCloudLibrary/pcl/pull/3365)] +* **[common]** Add `PCLPointCloud2::operator+=()` and update concatenation operation [[#3320](https://github.com/PointCloudLibrary/pcl/pull/3320)] +* **[segmentation]** Delete unused params in `OrganizedMultiPlaneSegmentation::refine()` [[#3302](https://github.com/PointCloudLibrary/pcl/pull/3302)] +* **[visualization]** Add new overload of `PointCloudColorHandler::getColor()` [[#3187](https://github.com/PointCloudLibrary/pcl/pull/3187)] +* **[modernization][io]** Add `registerCallback()` overload to grabbers to support assignment of `boost::function`s with templated signatures [[#3128](https://github.com/PointCloudLibrary/pcl/pull/3128)] +* **[surface]** Convert `MovingLeastSquaresOMP` into an alias template and deprecate [[#3119](https://github.com/PointCloudLibrary/pcl/pull/3119)] +* **[kdtree]** Remove unnecessary FLANN includes, deprecate "kdtree/flann.h" header [[#2993](https://github.com/PointCloudLibrary/pcl/pull/2993)] +* **[features]** Deprecate `computeRSD()` functions that take pointclouds by pointer [[#2827](https://github.com/PointCloudLibrary/pcl/pull/2827)] +* **[modernization]** Deprecate `pcl_isnan`, `pcl_isfinite`, and `pcl_isinf` in favor of `std` methods [[#2798](https://github.com/PointCloudLibrary/pcl/pull/2798), [#3457](https://github.com/PointCloudLibrary/pcl/pull/3457)] +* **[filters]** Restructure and add functionality to filters templated on `PCLPointCloud2` [[#3483](https://github.com/PointCloudLibrary/pcl/pull/3483), [#3500](https://github.com/PointCloudLibrary/pcl/pull/3500)] + +### `Removed:` + +*Removal of deprecated code.* + +* **[segmentation]** Remove `SupervoxelClustering::getColoredVoxelCloud()` [[#3469](https://github.com/PointCloudLibrary/pcl/pull/3469)] +* **[io]** Remove FZ-API [[#2747](https://github.com/PointCloudLibrary/pcl/pull/2747)] + +### `Behavioral changes:` + +*Changes in the expected default behavior.* + +* **[sample_consensus]** Set default min and max angle for SAC cone models [[#3466](https://github.com/PointCloudLibrary/pcl/pull/3466)] +* **[tools]** Do not discard data fields in `pcl_uniform_sampling` tool [[#3461](https://github.com/PointCloudLibrary/pcl/pull/3461)] +* **[common]** Disable colored output for non-interactive terminals [[#3310](https://github.com/PointCloudLibrary/pcl/pull/3310)] +* **[io]** Add support for device URI in `OpenNI2Grabber` constructor [[#3238](https://github.com/PointCloudLibrary/pcl/pull/3238)] +* **[common]** Enforce right-hand-rule on PCA eigenvectors [[#2946](https://github.com/PointCloudLibrary/pcl/pull/2946)] +* **[visualization]** Improve c/C command in `PCLVisualizer` [[#2926](https://github.com/PointCloudLibrary/pcl/pull/2926)] +* **[registration]** Fix ICP misbehavior in the "failure after maximum iterations" mode [[#2892](https://github.com/PointCloudLibrary/pcl/pull/2892)] +* **[common]** Initialize curvature in `PointNormal` default constructor [[#2674](https://github.com/PointCloudLibrary/pcl/pull/2674)] + +### `API changes:` + +*Changes to the API which didn't go through the proper deprecation and removal cycle.* + +* **[gpu]** Replace `uint64_type` by `std::uint64_t` [[#3435](https://github.com/PointCloudLibrary/pcl/pull/3435)] +* **[modernization]** Migrate from `boost::tuple` to `std::tuple` [[#3250](https://github.com/PointCloudLibrary/pcl/pull/3250)] +* **[modernization]** Migrate `boost::function` to `std::function` [[#3079](https://github.com/PointCloudLibrary/pcl/pull/3079)] + +### `ABI changes:` + +*Changes that cause ABI incompatibility but are still API compatible.* + +* **[modernization]** Migrate from `boost::unordered_map` to `std::unordered_map` [[#3107](https://github.com/PointCloudLibrary/pcl/pull/3107)] +* **[modernization]** Migrate to standard library type traits [[#3105](https://github.com/PointCloudLibrary/pcl/pull/3105)] +* **[visualization]** Minor refactoring of `pcl::visualization::Camera` and related functions [[#2901](https://github.com/PointCloudLibrary/pcl/pull/2901)] +* **[modernization]** Migrate from `boost::thread` to `std::thread` [[#3060](https://github.com/PointCloudLibrary/pcl/pull/3060), [#3094](https://github.com/PointCloudLibrary/pcl/pull/3094)] +* **[modernization]** Prefer using `Ptr` typedefs and migrate to `std` smart pointers in non-API code [[#2804](https://github.com/PointCloudLibrary/pcl/pull/2804), [#2821](https://github.com/PointCloudLibrary/pcl/pull/2821), [#2823](https://github.com/PointCloudLibrary/pcl/pull/2823), [#2929](https://github.com/PointCloudLibrary/pcl/pull/2929), [#3061](https://github.com/PointCloudLibrary/pcl/pull/3061), [#3141](https://github.com/PointCloudLibrary/pcl/pull/3141), [#3142](https://github.com/PointCloudLibrary/pcl/pull/3142), [#3217](https://github.com/PointCloudLibrary/pcl/pull/3217), [#3474](https://github.com/PointCloudLibrary/pcl/pull/3474), [#3482](https://github.com/PointCloudLibrary/pcl/pull/3482), [#3486](https://github.com/PointCloudLibrary/pcl/pull/3486), [#3489](https://github.com/PointCloudLibrary/pcl/pull/3489), [#3497](https://github.com/PointCloudLibrary/pcl/pull/3497)] +* **[modernization]** Migrate to `std` random number generators [[#2956](https://github.com/PointCloudLibrary/pcl/pull/2956), [#2962](https://github.com/PointCloudLibrary/pcl/pull/2962), [#3069](https://github.com/PointCloudLibrary/pcl/pull/3069)] +* **[filters]** Restructure and add functionality to filters templated on `PCLPointCloud2` [[#3483](https://github.com/PointCloudLibrary/pcl/pull/3483), [#3500](https://github.com/PointCloudLibrary/pcl/pull/3500)] + +### `Migration to C++14 and code modernization:` + +* Convert `boost::shared_ptr` to `pcl::shared_ptr` [[#3546](https://github.com/PointCloudLibrary/pcl/pull/3546)] +* Better indices in loops [[#3543](https://github.com/PointCloudLibrary/pcl/pull/3543)] +* Replace raw arrays with `std::vector`s in `RangeImageBorderExtractor` [[#3533](https://github.com/PointCloudLibrary/pcl/pull/3533)] +* Remove redundant calls to `std::string::c_str()` [[#3517](https://github.com/PointCloudLibrary/pcl/pull/3517)] +* Convert `pcl::int_t` to `std::int_t` [[#3422](https://github.com/PointCloudLibrary/pcl/pull/3422)] +* Remove deprecated `throw` specifier [[#3384](https://github.com/PointCloudLibrary/pcl/pull/3384)] +* Prefer `numeric_limits` from standard library [[#3360](https://github.com/PointCloudLibrary/pcl/pull/3360)] +* Add missing `std::move` or `const` reference for parameters [[#3253](https://github.com/PointCloudLibrary/pcl/pull/3253)] +* **[api]** Migrate from `boost::tuple` to `std::tuple` [[#3250](https://github.com/PointCloudLibrary/pcl/pull/3250)] +* Migrate from `boost::bind` to `std::bind` [[#3249](https://github.com/PointCloudLibrary/pcl/pull/3249)] +* Use transparent functors [[#3224](https://github.com/PointCloudLibrary/pcl/pull/3224)] +* Add `cloexec` option to `fopen` [[#3223](https://github.com/PointCloudLibrary/pcl/pull/3223)] +* **[deprecation]** Add `registerCallback()` overload to grabbers to support assignment of `boost::function`s with templated signatures [[#3128](https://github.com/PointCloudLibrary/pcl/pull/3128)] +* **[abi]** Migrate from `boost::unordered_map` to `std::unordered_map` [[#3107](https://github.com/PointCloudLibrary/pcl/pull/3107)] +* **[abi]** Migrate to standard library type traits [[#3105](https://github.com/PointCloudLibrary/pcl/pull/3105)] +* Remove dead stores [[#3095](https://github.com/PointCloudLibrary/pcl/pull/3095)] +* **[api]** Migrate `boost::function` to `std::function` [[#3079](https://github.com/PointCloudLibrary/pcl/pull/3079)] +* Remove redundant member field initialization [[#3070](https://github.com/PointCloudLibrary/pcl/pull/3070)] +* Prefer returning braced init list [[#3039](https://github.com/PointCloudLibrary/pcl/pull/3039)] +* Prefer `empty()` over `size()` when checking container state [[#3033](https://github.com/PointCloudLibrary/pcl/pull/3033)] +* Prefer combined assignment operators [[#3030](https://github.com/PointCloudLibrary/pcl/pull/3030)] +* Remove unnecessary `nullptr` checks before `delete` [[#2990](https://github.com/PointCloudLibrary/pcl/pull/2990)] +* Improve readability of string comparisons [[#2986](https://github.com/PointCloudLibrary/pcl/pull/2986)] +* Prefer `std::isnan` over `!=` comparison trick [[#2977](https://github.com/PointCloudLibrary/pcl/pull/2977)] +* Remove deprecated Boost Filesystem code [[#2966](https://github.com/PointCloudLibrary/pcl/pull/2966)] +* Migrate from `BOOST_STATIC_ASSERT` and `EIGEN_ASSERT` to `static_assert` [[#2951](https://github.com/PointCloudLibrary/pcl/pull/2951)] +* Prefer `std::log2` over custom implementation [[#2950](https://github.com/PointCloudLibrary/pcl/pull/2950)] +* Migrate from `boost::this_thread::sleep` to `std::this_thread::sleep_for` [[#2921](https://github.com/PointCloudLibrary/pcl/pull/2921)] +* Fix bug prone loop variables that are too small [[#2829](https://github.com/PointCloudLibrary/pcl/pull/2829)] +* Migrate from `boost::math::isnan` to `std::isnan` [[#2819](https://github.com/PointCloudLibrary/pcl/pull/2819)] +* Fix "variableScope" hints from CppCheck [[#2807](https://github.com/PointCloudLibrary/pcl/pull/2807)] +* Improve performance of finding single character in strings [[#2794](https://github.com/PointCloudLibrary/pcl/pull/2794)] +* Prefer using `bool` literals [[#2793](https://github.com/PointCloudLibrary/pcl/pull/2793)] +* Simplify boolean expressions [[#2790](https://github.com/PointCloudLibrary/pcl/pull/2790)] +* Prefer raw strings over escaped strings [[#2789](https://github.com/PointCloudLibrary/pcl/pull/2789)] +* Prefer `std::to_string` over `boost::lexical_cast` for integer conversions [[#2785](https://github.com/PointCloudLibrary/pcl/pull/2785)] +* Prefer `emplace_back` over `push_back` [[#2784](https://github.com/PointCloudLibrary/pcl/pull/2784)] +* Remove unnecessary void parameter [[#2780](https://github.com/PointCloudLibrary/pcl/pull/2780)] +* Use `=delete` to disable special members [[#2779](https://github.com/PointCloudLibrary/pcl/pull/2779)] +* Fix access to static members through instances [[#2776](https://github.com/PointCloudLibrary/pcl/pull/2776)] +* Remove usage of deprecated `register`storage class specifier [[#2761](https://github.com/PointCloudLibrary/pcl/pull/2761)] +* Remove redundant string initialization with `""` [[#2758](https://github.com/PointCloudLibrary/pcl/pull/2758)] +* Add `cloexec` option to `fopen` [[#2755](https://github.com/PointCloudLibrary/pcl/pull/2755)] +* Replace deprecated C library headers [[#2737](https://github.com/PointCloudLibrary/pcl/pull/2737)] +* Modernize code to use `override` [[#2728](https://github.com/PointCloudLibrary/pcl/pull/2728)] +* Prefer standard `[[deprecated]]` attribute [[#2699](https://github.com/PointCloudLibrary/pcl/pull/2699)] +* **[new-feature]** Enable C++ 14 flags [[#2690](https://github.com/PointCloudLibrary/pcl/pull/2690)] +* Revise arguments which were being passed by value instead of as a reference [[#2668](https://github.com/PointCloudLibrary/pcl/pull/2668)] +* Fix "knownConditionTrueFalse" hints from CppCheck [[#2648](https://github.com/PointCloudLibrary/pcl/pull/2648)] +* Fix "unreadVariable" hints from CppCheck [[#2645](https://github.com/PointCloudLibrary/pcl/pull/2645)] +* Replace `hash_map` with `unordered_map` in 3rdparty/poisson4 [[#2640](https://github.com/PointCloudLibrary/pcl/pull/2640)] +* Prefer lambdas over binds [[#3136](https://github.com/PointCloudLibrary/pcl/pull/3136), [#3171](https://github.com/PointCloudLibrary/pcl/pull/3171), [#3173](https://github.com/PointCloudLibrary/pcl/pull/3173), [#3178](https://github.com/PointCloudLibrary/pcl/pull/3178), [#3189](https://github.com/PointCloudLibrary/pcl/pull/3189), [#3192](https://github.com/PointCloudLibrary/pcl/pull/3192), [#3199](https://github.com/PointCloudLibrary/pcl/pull/3199), [#3209](https://github.com/PointCloudLibrary/pcl/pull/3209), [#3231](https://github.com/PointCloudLibrary/pcl/pull/3231), [#3243](https://github.com/PointCloudLibrary/pcl/pull/3243), [#3254](https://github.com/PointCloudLibrary/pcl/pull/3254)] +* Prefer range-based for loops [[#2812](https://github.com/PointCloudLibrary/pcl/pull/2812), [#2834](https://github.com/PointCloudLibrary/pcl/pull/2834), [#2835](https://github.com/PointCloudLibrary/pcl/pull/2835), [#2836](https://github.com/PointCloudLibrary/pcl/pull/2836), [#2837](https://github.com/PointCloudLibrary/pcl/pull/2837), [#2838](https://github.com/PointCloudLibrary/pcl/pull/2838), [#2839](https://github.com/PointCloudLibrary/pcl/pull/2839), [#2840](https://github.com/PointCloudLibrary/pcl/pull/2840), [#2841](https://github.com/PointCloudLibrary/pcl/pull/2841), [#2842](https://github.com/PointCloudLibrary/pcl/pull/2842), [#2843](https://github.com/PointCloudLibrary/pcl/pull/2843), [#2844](https://github.com/PointCloudLibrary/pcl/pull/2844), [#2845](https://github.com/PointCloudLibrary/pcl/pull/2845), [#2846](https://github.com/PointCloudLibrary/pcl/pull/2846), [#2847](https://github.com/PointCloudLibrary/pcl/pull/2847), [#2848](https://github.com/PointCloudLibrary/pcl/pull/2848), [#2849](https://github.com/PointCloudLibrary/pcl/pull/2849), [#2850](https://github.com/PointCloudLibrary/pcl/pull/2850), [#2851](https://github.com/PointCloudLibrary/pcl/pull/2851), [#2853](https://github.com/PointCloudLibrary/pcl/pull/2853), [#2854](https://github.com/PointCloudLibrary/pcl/pull/2854), [#2855](https://github.com/PointCloudLibrary/pcl/pull/2855), [#2856](https://github.com/PointCloudLibrary/pcl/pull/2856), [#2857](https://github.com/PointCloudLibrary/pcl/pull/2857), [#2858](https://github.com/PointCloudLibrary/pcl/pull/2858), [#2859](https://github.com/PointCloudLibrary/pcl/pull/2859), [#2860](https://github.com/PointCloudLibrary/pcl/pull/2860), [#2887](https://github.com/PointCloudLibrary/pcl/pull/2887), [#3396](https://github.com/PointCloudLibrary/pcl/pull/3396), [#3557](https://github.com/PointCloudLibrary/pcl/pull/3557)] +* Prefer `nullptr` over 0 and `NULL` [[#3004](https://github.com/PointCloudLibrary/pcl/pull/3004), [#3005](https://github.com/PointCloudLibrary/pcl/pull/3005), [#3006](https://github.com/PointCloudLibrary/pcl/pull/3006), [#3007](https://github.com/PointCloudLibrary/pcl/pull/3007), [#3008](https://github.com/PointCloudLibrary/pcl/pull/3008), [#3009](https://github.com/PointCloudLibrary/pcl/pull/3009), [#3010](https://github.com/PointCloudLibrary/pcl/pull/3010), [#3011](https://github.com/PointCloudLibrary/pcl/pull/3011), [#3012](https://github.com/PointCloudLibrary/pcl/pull/3012), [#3013](https://github.com/PointCloudLibrary/pcl/pull/3013), [#3014](https://github.com/PointCloudLibrary/pcl/pull/3014), [#3015](https://github.com/PointCloudLibrary/pcl/pull/3015), [#3016](https://github.com/PointCloudLibrary/pcl/pull/3016), [#3017](https://github.com/PointCloudLibrary/pcl/pull/3017), [#3018](https://github.com/PointCloudLibrary/pcl/pull/3018), [#3019](https://github.com/PointCloudLibrary/pcl/pull/3019), [#3020](https://github.com/PointCloudLibrary/pcl/pull/3020), [#3021](https://github.com/PointCloudLibrary/pcl/pull/3021), [#3022](https://github.com/PointCloudLibrary/pcl/pull/3022), [#3023](https://github.com/PointCloudLibrary/pcl/pull/3023), [#3024](https://github.com/PointCloudLibrary/pcl/pull/3024), [#3025](https://github.com/PointCloudLibrary/pcl/pull/3025), [#3026](https://github.com/PointCloudLibrary/pcl/pull/3026), [#3027](https://github.com/PointCloudLibrary/pcl/pull/3027), [#3028](https://github.com/PointCloudLibrary/pcl/pull/3028), [#3029](https://github.com/PointCloudLibrary/pcl/pull/3029)] +* Migrate to `std::chrono` [[#2913](https://github.com/PointCloudLibrary/pcl/pull/2913), [#2919](https://github.com/PointCloudLibrary/pcl/pull/2919), [#3318](https://github.com/PointCloudLibrary/pcl/pull/3318)] +* **[abi]** Migrate from `boost::thread` to `std::thread` [[#3060](https://github.com/PointCloudLibrary/pcl/pull/3060), [#3094](https://github.com/PointCloudLibrary/pcl/pull/3094)] +* Migrate `mutex`, `lock` and `csv` to modernization [[#3063](https://github.com/PointCloudLibrary/pcl/pull/3063), [#3068](https://github.com/PointCloudLibrary/pcl/pull/3068), [#3074](https://github.com/PointCloudLibrary/pcl/pull/3074), [#3078](https://github.com/PointCloudLibrary/pcl/pull/3078), [#3084](https://github.com/PointCloudLibrary/pcl/pull/3084), [#3086](https://github.com/PointCloudLibrary/pcl/pull/3086), [#3088](https://github.com/PointCloudLibrary/pcl/pull/3088), [#3091](https://github.com/PointCloudLibrary/pcl/pull/3091), [#3093](https://github.com/PointCloudLibrary/pcl/pull/3093), [#3100](https://github.com/PointCloudLibrary/pcl/pull/3100)] +* Prefer `using` over `typedef` [[#3112](https://github.com/PointCloudLibrary/pcl/pull/3112), [#3113](https://github.com/PointCloudLibrary/pcl/pull/3113), [#3115](https://github.com/PointCloudLibrary/pcl/pull/3115), [#3117](https://github.com/PointCloudLibrary/pcl/pull/3117), [#3118](https://github.com/PointCloudLibrary/pcl/pull/3118), [#3121](https://github.com/PointCloudLibrary/pcl/pull/3121), [#3122](https://github.com/PointCloudLibrary/pcl/pull/3122), [#3123](https://github.com/PointCloudLibrary/pcl/pull/3123), [#3124](https://github.com/PointCloudLibrary/pcl/pull/3124), [#3125](https://github.com/PointCloudLibrary/pcl/pull/3125), [#3129](https://github.com/PointCloudLibrary/pcl/pull/3129), [#3130](https://github.com/PointCloudLibrary/pcl/pull/3130), [#3132](https://github.com/PointCloudLibrary/pcl/pull/3132), [#3134](https://github.com/PointCloudLibrary/pcl/pull/3134), [#3137](https://github.com/PointCloudLibrary/pcl/pull/3137), [#3138](https://github.com/PointCloudLibrary/pcl/pull/3138), [#3139](https://github.com/PointCloudLibrary/pcl/pull/3139), [#3144](https://github.com/PointCloudLibrary/pcl/pull/3144)] +* Prefer `std` math functions over C functions [[#3087](https://github.com/PointCloudLibrary/pcl/pull/3087), [#3236](https://github.com/PointCloudLibrary/pcl/pull/3236), [#3255](https://github.com/PointCloudLibrary/pcl/pull/3255), [#3256](https://github.com/PointCloudLibrary/pcl/pull/3256), [#3257](https://github.com/PointCloudLibrary/pcl/pull/3257), [#3258](https://github.com/PointCloudLibrary/pcl/pull/3258), [#3270](https://github.com/PointCloudLibrary/pcl/pull/3270), [#3271](https://github.com/PointCloudLibrary/pcl/pull/3271), [#3272](https://github.com/PointCloudLibrary/pcl/pull/3272), [#3280](https://github.com/PointCloudLibrary/pcl/pull/3280), [#3282](https://github.com/PointCloudLibrary/pcl/pull/3282), [#3287](https://github.com/PointCloudLibrary/pcl/pull/3287)] +* **[abi]** Prefer using `Ptr` typedefs and migrate to `std` smart pointers in non-API code [[#2804](https://github.com/PointCloudLibrary/pcl/pull/2804), [#2821](https://github.com/PointCloudLibrary/pcl/pull/2821), [#2823](https://github.com/PointCloudLibrary/pcl/pull/2823), [#2929](https://github.com/PointCloudLibrary/pcl/pull/2929), [#3061](https://github.com/PointCloudLibrary/pcl/pull/3061), [#3141](https://github.com/PointCloudLibrary/pcl/pull/3141), [#3142](https://github.com/PointCloudLibrary/pcl/pull/3142), [#3217](https://github.com/PointCloudLibrary/pcl/pull/3217), [#3474](https://github.com/PointCloudLibrary/pcl/pull/3474), [#3482](https://github.com/PointCloudLibrary/pcl/pull/3482), [#3486](https://github.com/PointCloudLibrary/pcl/pull/3486), [#3489](https://github.com/PointCloudLibrary/pcl/pull/3489), [#3497](https://github.com/PointCloudLibrary/pcl/pull/3497)] +* **[abi]** Migrate to `std` random number generators [[#2956](https://github.com/PointCloudLibrary/pcl/pull/2956), [#2962](https://github.com/PointCloudLibrary/pcl/pull/2962), [#3069](https://github.com/PointCloudLibrary/pcl/pull/3069)] +* **[deprecation]** Deprecate `pcl_isnan`, `pcl_isfinite`, and `pcl_isinf` in favor of `std` methods [[#2798](https://github.com/PointCloudLibrary/pcl/pull/2798), [#3457](https://github.com/PointCloudLibrary/pcl/pull/3457)] +* Add explicit `std::` prefix to standard types/functions [[#3265](https://github.com/PointCloudLibrary/pcl/pull/3265), [#3326](https://github.com/PointCloudLibrary/pcl/pull/3326), [#3327](https://github.com/PointCloudLibrary/pcl/pull/3327), [#3328](https://github.com/PointCloudLibrary/pcl/pull/3328), [#3354](https://github.com/PointCloudLibrary/pcl/pull/3354), [#3426](https://github.com/PointCloudLibrary/pcl/pull/3426), [#3434](https://github.com/PointCloudLibrary/pcl/pull/3434)] +* Remove `else` after `return` statement [[#3180](https://github.com/PointCloudLibrary/pcl/pull/3180), [#3181](https://github.com/PointCloudLibrary/pcl/pull/3181), [#3182](https://github.com/PointCloudLibrary/pcl/pull/3182), [#3183](https://github.com/PointCloudLibrary/pcl/pull/3183), [#3184](https://github.com/PointCloudLibrary/pcl/pull/3184), [#3185](https://github.com/PointCloudLibrary/pcl/pull/3185), [#3186](https://github.com/PointCloudLibrary/pcl/pull/3186)] +* Remove redundant `typename` keyword [[#2896](https://github.com/PointCloudLibrary/pcl/pull/2896), [#2897](https://github.com/PointCloudLibrary/pcl/pull/2897), [#2927](https://github.com/PointCloudLibrary/pcl/pull/2927)] +* Prefer `#pragma once` over `#ifndef` include guards [[#2617](https://github.com/PointCloudLibrary/pcl/pull/2617), [#2707](https://github.com/PointCloudLibrary/pcl/pull/2707)] +* Apply clang-format to white-listed modules [[#3343](https://github.com/PointCloudLibrary/pcl/pull/3343), [#3344](https://github.com/PointCloudLibrary/pcl/pull/3344), [#3356](https://github.com/PointCloudLibrary/pcl/pull/3356), [#3363](https://github.com/PointCloudLibrary/pcl/pull/3363), [#3393](https://github.com/PointCloudLibrary/pcl/pull/3393), [#3416](https://github.com/PointCloudLibrary/pcl/pull/3416)] +* Remove default constructors/destructors [[#3440](https://github.com/PointCloudLibrary/pcl/pull/3440), [#3454](https://github.com/PointCloudLibrary/pcl/pull/3454)] +* Fix various compiler warnings [[#2665](https://github.com/PointCloudLibrary/pcl/pull/2665), [#2775](https://github.com/PointCloudLibrary/pcl/pull/2775), [#2778](https://github.com/PointCloudLibrary/pcl/pull/2778), [#2781](https://github.com/PointCloudLibrary/pcl/pull/2781), [#2782](https://github.com/PointCloudLibrary/pcl/pull/2782), [#2822](https://github.com/PointCloudLibrary/pcl/pull/2822), [#2898](https://github.com/PointCloudLibrary/pcl/pull/2898), [#2907](https://github.com/PointCloudLibrary/pcl/pull/2907), [#3001](https://github.com/PointCloudLibrary/pcl/pull/3001), [#3075](https://github.com/PointCloudLibrary/pcl/pull/3075), [#3076](https://github.com/PointCloudLibrary/pcl/pull/3076), [#3153](https://github.com/PointCloudLibrary/pcl/pull/3153), [#3155](https://github.com/PointCloudLibrary/pcl/pull/3155), [#3208](https://github.com/PointCloudLibrary/pcl/pull/3208), [#3212](https://github.com/PointCloudLibrary/pcl/pull/3212), [#3214](https://github.com/PointCloudLibrary/pcl/pull/3214), [#3342](https://github.com/PointCloudLibrary/pcl/pull/3342), [#3345](https://github.com/PointCloudLibrary/pcl/pull/3345), [#3348](https://github.com/PointCloudLibrary/pcl/pull/3348), [#3366](https://github.com/PointCloudLibrary/pcl/pull/3366), [#3372](https://github.com/PointCloudLibrary/pcl/pull/3372), [#3375](https://github.com/PointCloudLibrary/pcl/pull/3375), [#3377](https://github.com/PointCloudLibrary/pcl/pull/3377), [#3385](https://github.com/PointCloudLibrary/pcl/pull/3385), [#3388](https://github.com/PointCloudLibrary/pcl/pull/3388), [#3409](https://github.com/PointCloudLibrary/pcl/pull/3409), [#3425](https://github.com/PointCloudLibrary/pcl/pull/3425), [#3427](https://github.com/PointCloudLibrary/pcl/pull/3427), [#3507](https://github.com/PointCloudLibrary/pcl/pull/3507), [#3509](https://github.com/PointCloudLibrary/pcl/pull/3509), [#3554](https://github.com/PointCloudLibrary/pcl/pull/3554), [#3555](https://github.com/PointCloudLibrary/pcl/pull/3555)] +* Prefer `std::size_t` in loops [[#3550](https://github.com/PointCloudLibrary/pcl/pull/3550), [#3556](https://github.com/PointCloudLibrary/pcl/pull/3556)] + +### `Modules:` + +#### `CMake:` + +* Set compile features on imported PCL targets [[#3567](https://github.com/PointCloudLibrary/pcl/pull/3567)] +* Create CMake imported targets for header-only modules [[#3495](https://github.com/PointCloudLibrary/pcl/pull/3495)] +* Add `PCL_WARNINGS_ARE_ERRORS` CMake option and enable it in Ubuntu 16.04 CI job [[#3478](https://github.com/PointCloudLibrary/pcl/pull/3478)] +* Avoid using `VERSION_GREATER_EQUAL` to preserve compatibility with CMake 3.5 [[#3460](https://github.com/PointCloudLibrary/pcl/pull/3460)] +* Remove policy push/pop from "PCLConfig.cmake" file [[#3431](https://github.com/PointCloudLibrary/pcl/pull/3431)] +* Fix link-type keywords in linked libraries in "PCLConfig.cmake" with CMake >= 3.11 [[#3341](https://github.com/PointCloudLibrary/pcl/pull/3341)] +* Update prefix hints in GTest finder script [[#3331](https://github.com/PointCloudLibrary/pcl/pull/3331)] +* PCL All-in-one Installer: add process to add/remove VTK path [[#3322](https://github.com/PointCloudLibrary/pcl/pull/3322)] +* Add `surface` module to the list of dependencies of `examples` [[#3295](https://github.com/PointCloudLibrary/pcl/pull/3295)] +* Add missing install rule for "2d/kernel.hpp" header [[#3278](https://github.com/PointCloudLibrary/pcl/pull/3278)] +* **[new-feature]** Add `format` compilation target that applies `clang-format` to whitelisted modules [[#3188](https://github.com/PointCloudLibrary/pcl/pull/3188)] +* Use `COMPONENTS` when finding VTK to avoid linking agains unnecessary modules [[#3140](https://github.com/PointCloudLibrary/pcl/pull/3140)] +* Add thread library of the system by `Threads::Threads` instead of via `-pthread` flag [[#3102](https://github.com/PointCloudLibrary/pcl/pull/3102)] +* Fix `find_package_handle_standard_args` incorrect argument in GTest finder script [[#3098](https://github.com/PointCloudLibrary/pcl/pull/3098)] +* Fix compound target's target registration [[#3090](https://github.com/PointCloudLibrary/pcl/pull/3090)] +* Set `CMP0072` to `NEW` to prefer `GLVND` over legacy OpenGL modules [[#3066](https://github.com/PointCloudLibrary/pcl/pull/3066)] +* Improve parsing of `BUNDLE` option in `PCL_ADD_EXECUTABLE` [[#3064](https://github.com/PointCloudLibrary/pcl/pull/3064)] +* Change debug/release targets postfix on Windows [[#3055](https://github.com/PointCloudLibrary/pcl/pull/3055)] +* Add version info on Windows for DLLs/Exe [[#3054](https://github.com/PointCloudLibrary/pcl/pull/3054)] +* Modernize some CMake macros (Increases minimum required CMake version to 3.5) [[#3044](https://github.com/PointCloudLibrary/pcl/pull/3044)] +* Add newer Boost versions to `Boost_ADDITIONAL_VERSIONS` [[#3003](https://github.com/PointCloudLibrary/pcl/pull/3003)] +* Refactor `PCL_MAKE_PKGCONFIG` [[#2894](https://github.com/PointCloudLibrary/pcl/pull/2894)] +* Bump Eigen minimum version to 3.1 [[#2893](https://github.com/PointCloudLibrary/pcl/pull/2893)] +* Improve compatibility with latest VTK [[#2885](https://github.com/PointCloudLibrary/pcl/pull/2885)] +* PCL All-in-one Installer: add quiet flag to msiexec installs [[#2873](https://github.com/PointCloudLibrary/pcl/pull/2873)] +* Use `-mtune` instead of `-march` on non-x86 CPUs [[#2868](https://github.com/PointCloudLibrary/pcl/pull/2868)] +* Prevent adding `/MP` flag for MSVC in case any other language than C/CXX will be used (e.g. CUDA) [[#2862](https://github.com/PointCloudLibrary/pcl/pull/2862)] +* Add support for Visual Studio 2019 [[#2826](https://github.com/PointCloudLibrary/pcl/pull/2826)] +* Drop MSVC 2013 (and below) support [[#2817](https://github.com/PointCloudLibrary/pcl/pull/2817)] +* Drop GCC 4 support [[#2760](https://github.com/PointCloudLibrary/pcl/pull/2760)] +* Mark include directories of 3rd-party libraries as system includes [[#2733](https://github.com/PointCloudLibrary/pcl/pull/2733)] +* Fix Qt5 CMake issue [[#2719](https://github.com/PointCloudLibrary/pcl/pull/2719)] +* Reduce unnecessary nesting in "CMakeLists.txt" [[#2718](https://github.com/PointCloudLibrary/pcl/pull/2718)] +* Drop Qt4 support [[#2716](https://github.com/PointCloudLibrary/pcl/pull/2716)] +* Remove unnecessary `VTK_INCLUDE_DIRECTORIES` [[#2713](https://github.com/PointCloudLibrary/pcl/pull/2713)] +* Add `MSVC_MP` CMake option to adjust number of parallel build jobs [[#2705](https://github.com/PointCloudLibrary/pcl/pull/2705)] +* Set interface compile features to `cxx_std_14` on PCL targets [[#2697](https://github.com/PointCloudLibrary/pcl/pull/2697)] +* Reorganize and beautify project generation for IDEs [[#2691](https://github.com/PointCloudLibrary/pcl/pull/2691)] +* **[new-feature]** Enable C++ 14 flags [[#2690](https://github.com/PointCloudLibrary/pcl/pull/2690)] +* Remove vendored "FindGLEW.cmake" and adopt imported targets; rename "FindGTest.cmake" to prevent name clash [[#2679](https://github.com/PointCloudLibrary/pcl/pull/2679)] +* Add compound CMake targets for examples, tools, and apps [[#2673](https://github.com/PointCloudLibrary/pcl/pull/2673)] +* Set CMake policy `CMP0074` to `NEW` [[#2671](https://github.com/PointCloudLibrary/pcl/pull/2671)] +* Remove conditional code for no longer supported versions of CMake [[#2667](https://github.com/PointCloudLibrary/pcl/pull/2667)] +* Raise minimum required Boost version to 1.55; fix deprecated Boost endians [[#2801](https://github.com/PointCloudLibrary/pcl/pull/2801)] +* Modernize FLANN finder script [[#2740](https://github.com/PointCloudLibrary/pcl/pull/2740), [#2861](https://github.com/PointCloudLibrary/pcl/pull/2861), [#2905](https://github.com/PointCloudLibrary/pcl/pull/2905), [#2910](https://github.com/PointCloudLibrary/pcl/pull/2910), [#3157](https://github.com/PointCloudLibrary/pcl/pull/3157), [#3202](https://github.com/PointCloudLibrary/pcl/pull/3202), [#3220](https://github.com/PointCloudLibrary/pcl/pull/3220), [#3317](https://github.com/PointCloudLibrary/pcl/pull/3317)] + +#### `libpcl_2d:` + +* Fix `EIGEN_ALIGN16` positionining for point type `XYZHSV` [[#3237](https://github.com/PointCloudLibrary/pcl/pull/3237)] + +#### `libpcl_common:` + +* **[deprecation]** Revert smart pointer type change in `PointCloud` and deprecate `getMapping()` [[#3563](https://github.com/PointCloudLibrary/pcl/pull/3563)] +* Define `RangeImage` destructor as virtual [[#3477](https://github.com/PointCloudLibrary/pcl/pull/3477)] +* Refactor `pcl::eigen33()` to reduce potential errors (and remove bug) [[#3441](https://github.com/PointCloudLibrary/pcl/pull/3441)] +* Use generic detection idiom in `isFinite()` [[#3402](https://github.com/PointCloudLibrary/pcl/pull/3402)] +* **[deprecation]** Deprecate `getFields()` with output parameter in favor of overload with return value [[#3401](https://github.com/PointCloudLibrary/pcl/pull/3401)] +* Refactor polynomial calculations and remove memory leak [[#3392](https://github.com/PointCloudLibrary/pcl/pull/3392)] +* Removes deprecated usage of `getFields(cloud, fields)` [[#3374](https://github.com/PointCloudLibrary/pcl/pull/3374)] +* **[deprecation]** Deprecate `getFieldIndex()`/`getFields()` with first argument as cloud [[#3365](https://github.com/PointCloudLibrary/pcl/pull/3365)] +* Remove `vector.reserve()` from hot path in cloud concatenation [[#3361](https://github.com/PointCloudLibrary/pcl/pull/3361)] +* **[deprecation]** Add `PCLPointCloud2::operator+=()` and update concatenation operation [[#3320](https://github.com/PointCloudLibrary/pcl/pull/3320)] +* **[new-feature]** Add concatenate operation for `PolygonMesh` [[#3316](https://github.com/PointCloudLibrary/pcl/pull/3316)] +* Simplify the resize logic in `PCLBase` [[#3315](https://github.com/PointCloudLibrary/pcl/pull/3315)] +* **[behavior]** Disable colored output for non-interactive terminals [[#3310](https://github.com/PointCloudLibrary/pcl/pull/3310)] +* **[new-feature]** Add `emplace[_back]` to `pcl::PointCloud` [[#3207](https://github.com/PointCloudLibrary/pcl/pull/3207)] +* **[new-feature]** Add `pcl::make_shared` that automatically handles aligned allocations [[#3163](https://github.com/PointCloudLibrary/pcl/pull/3163)] +* **[behavior]** Enforce right-hand-rule on PCA eigenvectors [[#2946](https://github.com/PointCloudLibrary/pcl/pull/2946)] +* Fix a bug in `CentroidPoint` [[#2875](https://github.com/PointCloudLibrary/pcl/pull/2875)] +* **[behavior]** Initialize curvature in `PointNormal` default constructor [[#2674](https://github.com/PointCloudLibrary/pcl/pull/2674)] + +#### `libpcl_cuda:` + +* Remove code for CUDA below 7.5, update version checks [[#3152](https://github.com/PointCloudLibrary/pcl/pull/3152)] +* Add missing include to support CUDA 10.1 [[#2883](https://github.com/PointCloudLibrary/pcl/pull/2883)] +* Drop CUDA 7.0 (and below) support [[#2736](https://github.com/PointCloudLibrary/pcl/pull/2736)] + +#### `libpcl_features:` + +* Fix numerical issue in GASD estimation [[#3498](https://github.com/PointCloudLibrary/pcl/pull/3498)] +* **[deprecation]** Deprecate `computeRSD()` functions that take pointclouds by pointer [[#2827](https://github.com/PointCloudLibrary/pcl/pull/2827)] +* Fix data race in `NormalEstimationOMP` on Windows [[#2770](https://github.com/PointCloudLibrary/pcl/pull/2770)] + +#### `libpcl_filters:` + +* Merge pull request #3540 from facontidavide/fix_filter [[#3540](https://github.com/PointCloudLibrary/pcl/pull/3540)] +* Fix incorrect switch fallthrough in convolution operator [[#3429](https://github.com/PointCloudLibrary/pcl/pull/3429)] +* Use `size_t` for address computation in `CropBox` filter [[#3418](https://github.com/PointCloudLibrary/pcl/pull/3418)] +* Fix a bug in removed index extraction in `UniformSampling` [[#3323](https://github.com/PointCloudLibrary/pcl/pull/3323)] +* Fix `CropBox` with indices; add new assertions for unit tests [[#3306](https://github.com/PointCloudLibrary/pcl/pull/3306)] +* Use fixed-size Eigen block expressions in `FrustumCulling` [[#2786](https://github.com/PointCloudLibrary/pcl/pull/2786)] +* **[abi][deprecation]** Restructure and add functionality to filters templated on `PCLPointCloud2` [[#3483](https://github.com/PointCloudLibrary/pcl/pull/3483), [#3500](https://github.com/PointCloudLibrary/pcl/pull/3500)] + +#### `libpcl_gpu:` + +* Fix building of KinFu Large Scale app with Visual Studio [[#3504](https://github.com/PointCloudLibrary/pcl/pull/3504)] +* **[api]** Replace `uint64_type` by `std::uint64_t` [[#3435](https://github.com/PointCloudLibrary/pcl/pull/3435)] +* Add OpenNI2 support to `kinfu_largescale` tool [[#3391](https://github.com/PointCloudLibrary/pcl/pull/3391)] +* Use `constexpr` in KinFu and KinFu large scale apps [[#3386](https://github.com/PointCloudLibrary/pcl/pull/3386)] +* Remove duplicated and unused "cutil_math.h" [[#3264](https://github.com/PointCloudLibrary/pcl/pull/3264)] +* Drop unnecessary __CUDA_ARCH__ checks [[#3154](https://github.com/PointCloudLibrary/pcl/pull/3154)] +* Remove code for CUDA below 7.5, update version checks [[#3152](https://github.com/PointCloudLibrary/pcl/pull/3152)] +* Remove unused timer routines in "NCV.cu" [[#3135](https://github.com/PointCloudLibrary/pcl/pull/3135)] +* Add sync variants to CUDA vote functions to support PTX/ARCH >= 7.0 [[#2981](https://github.com/PointCloudLibrary/pcl/pull/2981)] +* Fix `-debug` option parsing in `people_pcd_prob` tool [[#2656](https://github.com/PointCloudLibrary/pcl/pull/2656)] + +#### `libpcl_io:` + +* Make PLY parser more tolerant towards files not adhering to standard [[#3542](https://github.com/PointCloudLibrary/pcl/pull/3542)] +* Fix a bug in binary header generation for PCD files [[#3522](https://github.com/PointCloudLibrary/pcl/pull/3522)] +* **[behavior]** Add support for device URI in `OpenNI2Grabber` constructor [[#3238](https://github.com/PointCloudLibrary/pcl/pull/3238)] +* Include "pcl_config.h" before checking `HAVE_OPENNI2` [[#3191](https://github.com/PointCloudLibrary/pcl/pull/3191)] +* Print descriptive error if PLY file not found [[#3143](https://github.com/PointCloudLibrary/pcl/pull/3143)] +* **[deprecation]** Add `registerCallback()` overload to grabbers to support assignment of `boost::function`s with templated signatures [[#3128](https://github.com/PointCloudLibrary/pcl/pull/3128)] +* Fix preallocation of memory in PLY reader [[#2800](https://github.com/PointCloudLibrary/pcl/pull/2800)] +* Fix possible integer overflow while iterating `PointCloud` fields [[#2754](https://github.com/PointCloudLibrary/pcl/pull/2754)] +* **[removal]** Remove FZ-API [[#2747](https://github.com/PointCloudLibrary/pcl/pull/2747)] +* Improve loading of massive PLY files [[#2715](https://github.com/PointCloudLibrary/pcl/pull/2715)] +* **[new-feature]** Add RSSDK 2.0 (librealsense2) grabber [[#2214](https://github.com/PointCloudLibrary/pcl/pull/2214)] +* Fix callback signatures in some grabbers [[#3216](https://github.com/PointCloudLibrary/pcl/pull/3216), [#3225](https://github.com/PointCloudLibrary/pcl/pull/3225)] + +#### `libpcl_kdtree:` + +* **[deprecation]** Remove unnecessary FLANN includes, deprecate "kdtree/flann.h" header [[#2993](https://github.com/PointCloudLibrary/pcl/pull/2993)] + +#### `libpcl_keypoints:` + +* Removed all duplicated branches in `AgastKeypoint2D` [[#2657](https://github.com/PointCloudLibrary/pcl/pull/2657)] + +#### `libpcl_recognition:` + +* Use range-based for loops with `boost::filesystem::directory_iterator` [[#3432](https://github.com/PointCloudLibrary/pcl/pull/3432)] +* **[deprecation]** Refactor `MaskMap` and deprecate several of its methods [[#3399](https://github.com/PointCloudLibrary/pcl/pull/3399)] +* Add missing include in "trimmed_icp.h" [[#3286](https://github.com/PointCloudLibrary/pcl/pull/3286)] +* Use I/O helper method in `pcl::LineRGBD` [[#2796](https://github.com/PointCloudLibrary/pcl/pull/2796)] + +#### `libpcl_registration:` + +* Make `Registration::hasConverged()` const-qualified [[#3456](https://github.com/PointCloudLibrary/pcl/pull/3456)] +* Fix debug message by reordering statements in GICP [[#3398](https://github.com/PointCloudLibrary/pcl/pull/3398)] +* **[new-feature]** Add linear least squares version of symmetric objective function for ICP [[#3390](https://github.com/PointCloudLibrary/pcl/pull/3390)] +* Fix the OpenMP errors/warnings in "ia_fpcs.hpp" [[#3389](https://github.com/PointCloudLibrary/pcl/pull/3389)] +* Fix `pcl::Registration::getFitnessScore()` documentation [[#3082](https://github.com/PointCloudLibrary/pcl/pull/3082)] +* **[behavior]** Fix ICP misbehavior in the "failure after maximum iterations" mode [[#2892](https://github.com/PointCloudLibrary/pcl/pull/2892)] + +#### `libpcl_sample_consensus:` + +* **[new-feature]** Add parallel RANSAC implementation with OpenMP [[#3514](https://github.com/PointCloudLibrary/pcl/pull/3514)] +* **[behavior]** Set default min and max angle for SAC cone models [[#3466](https://github.com/PointCloudLibrary/pcl/pull/3466)] +* Add `const` qualifier to multiple methods in SAC module [[#2970](https://github.com/PointCloudLibrary/pcl/pull/2970)] +* Fix regression in `pcl::SACSegmentation` line fitting [[#2767](https://github.com/PointCloudLibrary/pcl/pull/2767)] + +#### `libpcl_segmentation:` + +* **[removal]** Remove `SupervoxelClustering::getColoredVoxelCloud()` [[#3469](https://github.com/PointCloudLibrary/pcl/pull/3469)] +* **[deprecation]** Delete unused params in `OrganizedMultiPlaneSegmentation::refine()` [[#3302](https://github.com/PointCloudLibrary/pcl/pull/3302)] +* Add `noexcept` for `boost::checked_delete<>` friend [[#2942](https://github.com/PointCloudLibrary/pcl/pull/2942)] +* Fix `SupervoxelClustering` compilation problem in MSVC 2015.3 [[#2867](https://github.com/PointCloudLibrary/pcl/pull/2867)] + +#### `libpcl_simulation:` + +* Fix bug in `SimExample::write_depth_image_uint` trigerring `-Wtype-limits` warning [[#3430](https://github.com/PointCloudLibrary/pcl/pull/3430)] + +#### `libpcl_stereo:` + +* Merge pull request #3566 from kunaltyagi/stereo [[#3566](https://github.com/PointCloudLibrary/pcl/pull/3566)] + +#### `libpcl_surface:` + +* Fix undefined behaviour in `OctNode` [[#3561](https://github.com/PointCloudLibrary/pcl/pull/3561)] +* Fix memory leak in `TextureMapping` [[#3549](https://github.com/PointCloudLibrary/pcl/pull/3549)] +* Prevent `memset` for empty vector in 3rdparty/poisson4 [[#3537](https://github.com/PointCloudLibrary/pcl/pull/3537)] +* Remove incorrect tree update in `MarchingCubes` [[#3240](https://github.com/PointCloudLibrary/pcl/pull/3240)] +* **[deprecation]** Convert `MovingLeastSquaresOMP` into an alias template and deprecate [[#3119](https://github.com/PointCloudLibrary/pcl/pull/3119)] +* Fix a bug in `ConvexHull` when indices are used [[#2999](https://github.com/PointCloudLibrary/pcl/pull/2999)] +* Include "pcl_config.h" before testing `HAVE_QHULL` [[#2979](https://github.com/PointCloudLibrary/pcl/pull/2979)] +* Throw exceptions instead of `exit(0)` in Poisson surface reconstruction [[#2891](https://github.com/PointCloudLibrary/pcl/pull/2891)] +* Add check for invalid plane coefficients in `MovingLeastSquares` [[#2805](https://github.com/PointCloudLibrary/pcl/pull/2805)] +* Fix the size of the lookup table in `BilateralUpsampling` [[#2749](https://github.com/PointCloudLibrary/pcl/pull/2749)] +* Replace `hash_map` with `unordered_map` in 3rdparty/poisson4 [[#2640](https://github.com/PointCloudLibrary/pcl/pull/2640)] + +#### `libpcl_visualization:` + +* Add a flag to disable window autoresizing in `ImageViewer` [[#3394](https://github.com/PointCloudLibrary/pcl/pull/3394)] +* **[deprecation]** Add new overload of `PointCloudColorHandler::getColor()` [[#3187](https://github.com/PointCloudLibrary/pcl/pull/3187)] +* **[behavior]** Improve c/C command in `PCLVisualizer` [[#2926](https://github.com/PointCloudLibrary/pcl/pull/2926)] +* Disable VTK warning display with OpenGL rendering backend [[#2912](https://github.com/PointCloudLibrary/pcl/pull/2912)] +* **[abi]** Minor refactoring of `pcl::visualization::Camera` and related functions [[#2901](https://github.com/PointCloudLibrary/pcl/pull/2901)] +* Fix a bug in `PCLVisualizer::setShapeRenderingProperties()` [[#2900](https://github.com/PointCloudLibrary/pcl/pull/2900)] +* Fix possible integer overflow while iterating `PointCloud` fields [[#2754](https://github.com/PointCloudLibrary/pcl/pull/2754)] +* Raise minimum VTK version to 6.2 [[#2685](https://github.com/PointCloudLibrary/pcl/pull/2685)] + +#### `PCL Apps:` + +* Fix memory leaks in OpenNI apps [[#3553](https://github.com/PointCloudLibrary/pcl/pull/3553)] +* Use range-based for loops with `boost::filesystem::directory_iterator` [[#3432](https://github.com/PointCloudLibrary/pcl/pull/3432)] +* Do not use deprecated function in `stereo_ground_segmentation` [[#3406](https://github.com/PointCloudLibrary/pcl/pull/3406)] +* Add missing `std::move` or `const` reference for parameters [[#3232](https://github.com/PointCloudLibrary/pcl/pull/3232)] +* Remove magic numbers from `organized_segmentation_demo` app [[#3108](https://github.com/PointCloudLibrary/pcl/pull/3108)] +* Add missing include `render_views_tesselated_sphere` app [[#2909](https://github.com/PointCloudLibrary/pcl/pull/2909)] +* Remove Qt version checks [[#2762](https://github.com/PointCloudLibrary/pcl/pull/2762)] +* Cleanup Qt includes in Modeler app [[#2756](https://github.com/PointCloudLibrary/pcl/pull/2756)] +* Cleanup Qt includes in CloudComposer app [[#2744](https://github.com/PointCloudLibrary/pcl/pull/2744)] +* Fix MSVC compile issues in CloudComposer app [[#2712](https://github.com/PointCloudLibrary/pcl/pull/2712)] +* Fix Modeler app with OpenGL2 rendering backend [[#2653](https://github.com/PointCloudLibrary/pcl/pull/2653)] + +#### `PCL Docs:` + +* Fix and improve documentation in `sample_consensus` module [[#3301](https://github.com/PointCloudLibrary/pcl/pull/3301)] +* Fix `pcl::Registration::getFitnessScore()` documentation [[#3082](https://github.com/PointCloudLibrary/pcl/pull/3082)] +* Fix source file name path stripping in Doxygen [[#2714](https://github.com/PointCloudLibrary/pcl/pull/2714)] + +#### `PCL Tutorials:` + +* Fix "CMakeLists.txt" in VFH tutorial [[#3449](https://github.com/PointCloudLibrary/pcl/pull/3449)] +* Update information about types with RGBA data in tutorial [[#3294](https://github.com/PointCloudLibrary/pcl/pull/3294)] +* Add a note about adjusting passthrough limits in template alignment tutorial [[#3193](https://github.com/PointCloudLibrary/pcl/pull/3193)] +* Add missing shell command in "Building PCL" tutorial [[#2996](https://github.com/PointCloudLibrary/pcl/pull/2996)] +* Fix cube rendering properties in "Moment of Inertia" tutorial [[#2880](https://github.com/PointCloudLibrary/pcl/pull/2880)] +* Migrate from `boost::math::iround` to `std::lround` [[#2818](https://github.com/PointCloudLibrary/pcl/pull/2818)] +* Link with `PCL_LIBRARIES`, not `PCL_***_LIBRARIES` [[#2799](https://github.com/PointCloudLibrary/pcl/pull/2799)] + +#### `PCL Tests:` + +* Move OMP version of `MovingLeastSquares` into a separate test case [[#3382](https://github.com/PointCloudLibrary/pcl/pull/3382)] +* Fix `CropBox` with indices; add new assertions for unit tests [[#3306](https://github.com/PointCloudLibrary/pcl/pull/3306)] +* Fix `find_package_handle_standard_args` incorrect argument in GTest finder script [[#3098](https://github.com/PointCloudLibrary/pcl/pull/3098)] +* Do not test buffers instantiated with `char` template argument [[#2980](https://github.com/PointCloudLibrary/pcl/pull/2980)] +* Remove `GTEST_USE_OWN_TR1_TUPLE` defines [[#2828](https://github.com/PointCloudLibrary/pcl/pull/2828)] +* Add a new test for `SampleConsensusModelLine` [[#2768](https://github.com/PointCloudLibrary/pcl/pull/2768)] +* Split `test_registration` into three binaries [[#2727](https://github.com/PointCloudLibrary/pcl/pull/2727)] + +#### `PCL Tools:` + +* **[behavior]** Do not discard data fields in `pcl_uniform_sampling` tool [[#3461](https://github.com/PointCloudLibrary/pcl/pull/3461)] +* Add missing includes in `ensenso_viewer.cpp` [[#3035](https://github.com/PointCloudLibrary/pcl/pull/3035)] +* Do not terminate `openni_viewer`/`openni2_viewer` if image viewer was not instantiated [[#2698](https://github.com/PointCloudLibrary/pcl/pull/2698)] + +#### `CI:` + +* Add `PCL_WARNINGS_ARE_ERRORS` CMake option and enable it in Ubuntu 16.04 CI job [[#3478](https://github.com/PointCloudLibrary/pcl/pull/3478)] +* Add a new Azure pipeline for Ubuntu 19.10 [[#3446](https://github.com/PointCloudLibrary/pcl/pull/3446)] +* Add formatting job on CI [[#3420](https://github.com/PointCloudLibrary/pcl/pull/3420)] +* Add Dockerfiles for images used on CI [[#3350](https://github.com/PointCloudLibrary/pcl/pull/3350)] +* Publish test results on Azure pipelines [[#2948](https://github.com/PointCloudLibrary/pcl/pull/2948)] +* Build tutorials on Azure Pipelines [[#2696](https://github.com/PointCloudLibrary/pcl/pull/2696)] + ## *= 1.9.1 (26.11.2018) =* ### `Modules:` diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b4c1a33..93a64487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,22 @@ ### ---[ PCL global CMake -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) if(POLICY CMP0074) - # TODO: - # 1. Find*.cmake modules need to be individually verified. - # 2. PCLConfig.cmake needs to be changed. - cmake_policy(SET CMP0074 OLD) + # 1. Remove with 3.12.4. + # 2. Remove search paths with *_ROOT since they will be automatically checked + cmake_policy(SET CMP0074 NEW) +endif() + +# Set target C++ standard and required compiler features +set(CMAKE_CXX_STANDARD 14 CACHE STRING "The target C++ standard. PCL requires C++14 or higher.") +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +if(CMAKE_VERSION VERSION_LESS 3.8) + # CMake did not have cxx_std_14 compile feature prior to 3.8 + # We use cxx_attribute_deprecated as a proxy because this feature is a part of c++14 standard + set(PCL_CXX_COMPILE_FEATURES cxx_attribute_deprecated) +else() + set(PCL_CXX_COMPILE_FEATURES cxx_std_14) endif() set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "possible configurations" FORCE) @@ -15,7 +26,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "") set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "build type default to RelWithDebInfo, set to Release to improve performance" FORCE) endif() -project(PCL VERSION 1.9.1) +project(PCL VERSION 1.10.0) string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) ### ---[ Find universal dependencies @@ -29,42 +40,34 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebI add_definitions("-DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG") endif() if(WIN32 AND NOT MINGW) - if(NOT DEFINED CMAKE_DEBUG_POSTFIX) - set(CMAKE_DEBUG_POSTFIX "_debug") - endif() - if(NOT DEFINED CMAKE_RELEASE_POSTFIX) - set(CMAKE_RELEASE_POSTFIX "_release") - endif() - if(NOT DEFINED CMAKE_RELWITHDEBINFO_POSTFIX) - set(CMAKE_RELWITHDEBINFO_POSTFIX "_release") - endif() - if(NOT DEFINED CMAKE_MINSIZEREL_POSTFIX) - set(CMAKE_MINSIZEREL_POSTFIX "_release") - endif() + set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Add postfix to target for Debug build.") + set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Add postfix to target for Release build.") + set(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "Add postfix to target for RelWithDebInfo build.") + set(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "Add postfix to target for MinSizeRel build") endif() # ---[ special maintainer mode -SET(CMAKE_CXX_FLAGS_MAINTAINER "-pedantic -Wno-variadic-macros -Weffc++ -Wno-long-long" CACHE STRING +set(CMAKE_CXX_FLAGS_MAINTAINER "-pedantic -Wno-variadic-macros -Weffc++ -Wno-long-long" CACHE STRING "Flags used by the C++ compiler during maintainer builds." FORCE) -SET(CMAKE_C_FLAGS_MAINTAINER "-pedantic -Wno-variadic-macros -Weffc++ -Wno-long-long" CACHE STRING +set(CMAKE_C_FLAGS_MAINTAINER "-pedantic -Wno-variadic-macros -Weffc++ -Wno-long-long" CACHE STRING "Flags used by the C compiler during maintainer builds." FORCE) -SET(CMAKE_EXE_LINKER_FLAGS_MAINTAINER +set(CMAKE_EXE_LINKER_FLAGS_MAINTAINER "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING "Flags used for linking binaries during maintainer builds." FORCE) -SET(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER +set(CMAKE_SHARED_LINKER_FLAGS_MAINTAINER "-Wl,--warn-unresolved-symbols,--warn-once" CACHE STRING "Flags used by the shared libraries linker during maintainer builds." FORCE) -MARK_AS_ADVANCED( +mark_as_advanced( CMAKE_CXX_FLAGS_MAINTAINER CMAKE_C_FLAGS_MAINTAINER CMAKE_EXE_LINKER_FLAGS_MAINTAINER - CMAKE_SHARED_LINKER_FLAGS_MAINTAINER ) + CMAKE_SHARED_LINKER_FLAGS_MAINTAINER) # Update the documentation string of CMAKE_BUILD_TYPE for GUIs -SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING +set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Maintainer." FORCE) @@ -90,6 +93,12 @@ endif() include("${PCL_SOURCE_DIR}/cmake/pcl_verbosity.cmake") include("${PCL_SOURCE_DIR}/cmake/pcl_targets.cmake") include("${PCL_SOURCE_DIR}/cmake/pcl_options.cmake") +include("${PCL_SOURCE_DIR}/cmake/clang-format.cmake") + +if(${PCL_ENABLE_CCACHE}) + include (UseCompilerCache) + UseCompilerCache(ccache REQUIRED) +endif() # Enable verbose timing display? if(CMAKE_TIMING_VERBOSE AND UNIX) @@ -106,34 +115,27 @@ endif() # ---[ Unix/Darwin/Windows specific flags if(CMAKE_COMPILER_IS_GNUCXX) if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") - SET(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion ${SSE_FLAGS_STR}") - - # Enable -Wabi for GCC > 4.3, and -Wno-deprecated for GCC < 4.3 - # to disable a lot of warnings which are not fixable - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - if(GCC_VERSION VERSION_GREATER 4.3) - message(STATUS "-- GCC > 4.3 found, enabling -Wabi") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi=11") else() - message(STATUS "-- GCC < 4.3 found, enabling -Wno-deprecated") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wabi") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion ${SSE_FLAGS_STR}") + if(PCL_WARNINGS_ARE_ERRORS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") endif() endif() - if(NOT ANDROID) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") - endif(NOT ANDROID) - if("${CMAKE_SHARED_LINKER_FLAGS}" STREQUAL "" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") - SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") + set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") endif() if(WIN32) if(PCL_SHARED_LIBS) - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols -Wl,--enable-auto-import") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols -Wl,--enable-auto-import") if(MINGW) add_definitions("-DBOOST_THREAD_USE_LIB") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition") endif() else() add_definitions("-DBOOST_LIB_DIAGNOSTIC -DBOOST_THREAD_USE_LIB") @@ -145,52 +147,70 @@ if(CMAKE_COMPILER_IS_MSVC) add_definitions("-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX -DPCL_ONLY_CORE_POINT_TYPES /bigobj ${SSE_DEFINITIONS}") if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /fp:precise /wd4800 /wd4521 /wd4251 /wd4275 /wd4305 /wd4355 ${SSE_FLAGS_STR}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /fp:precise /wd4800 /wd4521 /wd4251 /wd4275 /wd4305 /wd4355 ${SSE_FLAGS_STR}") # Add extra code generation/link optimizations if(CMAKE_MSVC_CODE_LINK_OPTIMIZATION) - SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") - SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF") - SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG") endif() # /MANIFEST:NO") # please, don't disable manifest generation, otherwise crash at start for vs2008 - if(MSVC_VERSION GREATER 1500 AND ${CMAKE_VERSION} VERSION_GREATER "2.8.6") - include(ProcessorCount) - ProcessorCount(N) - if(NOT N EQUAL 0) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${N}") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${N}") + if(PCL_WARNINGS_ARE_ERRORS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + endif() + + include(ProcessorCount) + ProcessorCount(CPUCores) + set(MSVC_MP ${CPUCores} CACHE STRING "Number of simultaneously running compilers (0 = automatic detection by MSVC). See documentation of /MP flag.") + if (CMAKE_VERSION VERSION_LESS 3.11.0) + # Usage of COMPILE_LANGUAGE generator expression for MSVC in add_compile_options requires at least CMake 3.11, see https://gitlab.kitware.com/cmake/cmake/issues/17435 + if(MSVC_MP EQUAL 0) + # MSVC_MP is 0 in case the information cannot be determined by ProcessorCount => fallback + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") + elseif(MSVC_MP GREATER 1) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${MSVC_MP}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${MSVC_MP}") + endif() + else() + if(MSVC_MP EQUAL 0) + # MSVC_MP is 0 in case the information cannot be determined by ProcessorCount => fallback + # Generator expression is necessary to limit /MP flag to C/CXX, so flag will be not set to e.g. CUDA (see https://gitlab.kitware.com/cmake/cmake/issues/17535) + add_compile_options($<$,$>:/MP>) + elseif(MSVC_MP GREATER 1) + add_compile_options($<$,$>:/MP${MSVC_MP}>) endif() endif() endif() if(CMAKE_GENERATOR STREQUAL "Ninja") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FS") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FS") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS") endif() endif() if(CMAKE_COMPILER_IS_PATHSCALE) if("${CMAKE_CXX_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") - SET(CMAKE_CXX_FLAGS "-Wno-uninitialized -zerouv -pthread -mp") + set(CMAKE_CXX_FLAGS "-Wno-uninitialized -zerouv -mp") endif() if("${CMAKE_SHARED_LINKER_FLAGS}" STREQUAL "") - SET(CMAKE_SHARED_LINKER_FLAGS "-mp") + set(CMAKE_SHARED_LINKER_FLAGS "-mp") endif() endif() if(CMAKE_COMPILER_IS_CLANG) if("${CMAKE_C_FLAGS}" STREQUAL "${CMAKE_CXX_FLAGS_DEFAULT}") - SET(CMAKE_C_FLAGS "-Qunused-arguments") + set(CMAKE_C_FLAGS "-Qunused-arguments") endif() if("${CMAKE_CXX_FLAGS}" STREQUAL "") - SET(CMAKE_CXX_FLAGS "-ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof ${SSE_FLAGS_STR}") # Unfortunately older Clang versions do not have this: -Wno-unnamed-type-template-args + set(CMAKE_CXX_FLAGS "-ftemplate-depth=1024 -Qunused-arguments -Wno-invalid-offsetof ${SSE_FLAGS_STR}") # Unfortunately older Clang versions do not have this: -Wno-unnamed-type-template-args if(APPLE AND WITH_CUDA AND CUDA_FOUND) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++") endif() endif() - SET(CLANG_LIBRARIES "stdc++") + set(CLANG_LIBRARIES "stdc++") endif() include("${PCL_SOURCE_DIR}/cmake/pcl_utils.cmake") @@ -217,52 +237,51 @@ if(WIN32) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CONFIG} "${PCL_OUTPUT_BIN_DIR}") # ---[ Windows requires DLLs (shared libraries) to be installed in the same directory as executables set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CONFIG} "${PCL_OUTPUT_BIN_DIR}") - endforeach(config) + endforeach() else() set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PCL_OUTPUT_LIB_DIR}") endif() +# Check if the current generator is an IDE. +check_if_ide(CMAKE_GENERATOR_IS_IDE) + # Add an "uninstall" target +if(CMAKE_GENERATOR_IS_IDE) + set(UNINSTALL_TARGET_NAME UNINSTALL) +else() + set(UNINSTALL_TARGET_NAME uninstall) +endif() configure_file("${PCL_SOURCE_DIR}/cmake/uninstall_target.cmake.in" "${PCL_BINARY_DIR}/uninstall_target.cmake" IMMEDIATE @ONLY) -add_custom_target(uninstall "${CMAKE_COMMAND}" -P +add_custom_target(${UNINSTALL_TARGET_NAME} "${CMAKE_COMMAND}" -P "${PCL_BINARY_DIR}/uninstall_target.cmake") ### # this is copy paste form http://www.itk.org/Wiki/CMake_RPATH_handling # in order to always make a full statement RPATH ### -SET(CMAKE_SKIP_BUILD_RPATH FALSE) -SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") -SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set(CMAKE_SKIP_BUILD_RPATH FALSE) +set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" is_system_dir) -IF("${is_system_dir}" STREQUAL "-1") -SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") -ENDIF("${is_system_dir}" STREQUAL "-1") +if("${is_system_dir}" STREQUAL "-1") +set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}") +endif() ### ---[ Find universal dependencies -# the gcc-4.2.1 coming with MacOS X is not compatible with the OpenMP pragmas we use, so disabling OpenMP for it -if((NOT APPLE) OR (NOT CMAKE_COMPILER_IS_GNUCXX) OR (GCC_VERSION VERSION_GREATER 4.2.1) OR (CMAKE_COMPILER_IS_CLANG)) - find_package(OpenMP) -endif() +find_package(OpenMP) if(OPENMP_FOUND) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") message(STATUS "Found OpenMP") if(MSVC) - if(MSVC_VERSION EQUAL 1500) - set(OPENMP_DLL VCOMP90) - elseif(MSVC_VERSION EQUAL 1600) - set(OPENMP_DLL VCOMP100) - elseif(MSVC_VERSION EQUAL 1700) - set(OPENMP_DLL VCOMP110) - elseif(MSVC_VERSION EQUAL 1800) - set(OPENMP_DLL VCOMP120) - elseif(MSVC_VERSION EQUAL 1900) + if(MSVC_VERSION EQUAL 1900) set(OPENMP_DLL VCOMP140) elseif(MSVC_VERSION MATCHES "^191[0-9]$") set(OPENMP_DLL VCOMP140) + elseif(MSVC_VERSION MATCHES "^192[0-9]$") + set(OPENMP_DLL VCOMP140) endif() if(OPENMP_DLL) set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DELAYLOAD:${OPENMP_DLL}D.dll") @@ -270,13 +289,16 @@ if(OPENMP_FOUND) else() message(WARNING "Delay loading flag for OpenMP DLL is invalid.") endif() - endif(MSVC) + endif() else() message(STATUS "Not found OpenMP") endif() +# Threads (required) +find_package(Threads REQUIRED) + # Eigen (required) -find_package(Eigen REQUIRED) +find_package(Eigen 3.1 REQUIRED) include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) # FLANN (required) @@ -284,37 +306,36 @@ if(NOT PCL_SHARED_LIBS OR ((WIN32 AND NOT MINGW) AND NOT PCL_BUILD_WITH_FLANN_DY set(FLANN_USE_STATIC ON) endif() find_package(FLANN 1.7.0 REQUIRED) -include_directories(${FLANN_INCLUDE_DIRS}) # libusb-1.0 option(WITH_LIBUSB "Build USB RGBD-Camera drivers" TRUE) if(WITH_LIBUSB) find_package(libusb-1.0) if(LIBUSB_1_FOUND) - include_directories("${LIBUSB_1_INCLUDE_DIR}") + include_directories(SYSTEM "${LIBUSB_1_INCLUDE_DIR}") endif() endif() # Dependencies for different grabbers PCL_ADD_GRABBER_DEPENDENCY("OpenNI" "OpenNI grabber support") PCL_ADD_GRABBER_DEPENDENCY("OpenNI2" "OpenNI2 grabber support") -PCL_ADD_GRABBER_DEPENDENCY("FZAPI" "Fotonic camera support") PCL_ADD_GRABBER_DEPENDENCY("Ensenso" "IDS-Imaging Ensenso camera support") PCL_ADD_GRABBER_DEPENDENCY("davidSDK" "David Vision Systems SDK support") PCL_ADD_GRABBER_DEPENDENCY("DSSDK" "DepthSense SDK support") PCL_ADD_GRABBER_DEPENDENCY("RSSDK" "RealSense SDK support") +PCL_ADD_GRABBER_DEPENDENCY("RSSDK2" "RealSense SDK 2.0 (librealsense) support") # metslib if(PKG_CONFIG_FOUND) pkg_check_modules(METSLIB metslib) if(METSLIB_FOUND) set(HAVE_METSLIB ON) - include_directories(${METSLIB_INCLUDE_DIRS}) + include_directories(SYSTEM ${METSLIB_INCLUDE_DIRS}) else() - include_directories("${PCL_SOURCE_DIR}/recognition/include/pcl/recognition/3rdparty/") + include_directories(SYSTEM "${PCL_SOURCE_DIR}/recognition/include/pcl/recognition/3rdparty/") endif() else() - include_directories(${PCL_SOURCE_DIR}/recognition/include/pcl/recognition/3rdparty/) + include_directories(SYSTEM ${PCL_SOURCE_DIR}/recognition/include/pcl/recognition/3rdparty/) endif() # LibPNG @@ -323,7 +344,7 @@ if(WITH_PNG) find_package(PNG) if(PNG_FOUND) set(HAVE_PNG ON) - include_directories("${PNG_INCLUDE_DIR}") + include_directories(SYSTEM "${PNG_INCLUDE_DIR}") endif() endif() @@ -335,7 +356,7 @@ if(WITH_QHULL) endif() find_package(Qhull) if(QHULL_FOUND) - include_directories(${QHULL_INCLUDE_DIRS}) + include_directories(SYSTEM ${QHULL_INCLUDE_DIRS}) endif() endif() @@ -347,43 +368,67 @@ endif() option(WITH_QT "Build QT Front-End" TRUE) if(WITH_QT) - set(PCL_QT_VERSION 5 CACHE STRING "Which QT version to use") - if("${PCL_QT_VERSION}" STREQUAL "4") - find_package(Qt4) - if(QT4_FOUND) - include("${QT_USE_FILE}") - endif() - elseif("${PCL_QT_VERSION}" STREQUAL "5") - include(cmake/pcl_find_qt5.cmake) - else() - message(SEND_ERROR "PCL_QT_VERSION must be 4 or 5") - endif() + find_package(Qt5 COMPONENTS Concurrent OpenGL Widgets QUIET) endif() # Find VTK option(WITH_VTK "Build VTK-Visualizations" TRUE) if(WITH_VTK AND NOT ANDROID) - find_package(VTK) + set(PCL_VTK_COMPONENTS + vtkChartsCore + vtkCommonCore + vtkCommonDataModel + vtkCommonExecutionModel + vtkFiltersCore + vtkFiltersExtraction + vtkFiltersModeling + vtkImagingCore + vtkImagingSources + vtkInteractionStyle + vtkInteractionWidgets + vtkIOCore + vtkIOGeometry + vtkIOImage + vtkIOLegacy + vtkIOPLY + vtkRenderingAnnotation + vtkRenderingLOD + vtkViewsContext2D + ) + find_package(VTK COMPONENTS ${PCL_VTK_COMPONENTS}) + if(VTK_FOUND AND ("${VTK_VERSION}" VERSION_LESS 6.2)) + message(WARNING "The minimum required version of VTK is 6.2, but found ${VTK_VERSION}") + set(VTK_FOUND FALSE) + endif() + if(VTK_FOUND) if(NOT DEFINED VTK_RENDERING_BACKEND) # On old VTK versions this variable does not exist. In this case it is # safe to assume OpenGL backend set(VTK_RENDERING_BACKEND "OpenGL") endif() + list(APPEND PCL_VTK_COMPONENTS vtkRenderingContext${VTK_RENDERING_BACKEND}) + + if(WITH_QT) + if(";${VTK_MODULES_ENABLED};" MATCHES ";vtkGUISupportQt;" AND ";${VTK_MODULES_ENABLED};" MATCHES ";vtkRenderingQt;") + set(QVTK_FOUND ON) + list(APPEND PCL_VTK_COMPONENTS vtkRenderingQt vtkGUISupportQt) + else() + unset(QVTK_FOUND) + endif() + endif() + + find_package(VTK COMPONENTS ${PCL_VTK_COMPONENTS}) + message(STATUS "VTK_MAJOR_VERSION ${VTK_MAJOR_VERSION}, rendering backend: ${VTK_RENDERING_BACKEND}") if(PCL_SHARED_LIBS OR (NOT (PCL_SHARED_LIBS) AND NOT (VTK_BUILD_SHARED_LIBS))) - set(VTK_FOUND TRUE) - find_package(QVTK) - if(${VTK_MAJOR_VERSION} VERSION_LESS "6.0") - message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, lib: ${VTK_LIBRARY_DIRS})") - link_directories(${VTK_LIBRARY_DIRS}) - else() - include(${VTK_USE_FILE}) - message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, lib: ${VTK_LIBRARIES}") + if(VTK_USE_FILE) + include(${VTK_USE_FILE}) endif() + message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, libs: ${VTK_LIBRARIES}") if(APPLE) - option(VTK_USE_COCOA "Use Cocoa for VTK render windows" ON) - MARK_AS_ADVANCED(VTK_USE_COCOA) + option(VTK_USE_COCOA "Use Cocoa for VTK render windows" ON) + mark_as_advanced(VTK_USE_COCOA) endif() if(${VTK_RENDERING_BACKEND} STREQUAL "OpenGL") set(VTK_RENDERING_BACKEND_OPENGL_VERSION "1") @@ -426,12 +471,6 @@ configure_file("${pcl_config_h_in}" "${pcl_config_h}") PCL_ADD_INCLUDES(common "" "${pcl_config_h}") include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") -### ---[ Set up for tests -enable_testing() - -### ---[ Set up for examples -#include("${PCL_SOURCE_DIR}/cmake/pcl_examples.cmake") - ### ---[ Add the libraries subdirectories include("${PCL_SOURCE_DIR}/cmake/pcl_targets.cmake") @@ -441,7 +480,7 @@ topological_sort(PCL_MODULES_NAMES PCL_ _DEPENDS) sort_relative(PCL_MODULES_NAMES_UNSORTED PCL_MODULES_NAMES PCL_MODULES_DIRS) foreach(subdir ${PCL_MODULES_DIRS}) add_subdirectory("${PCL_SOURCE_DIR}/${subdir}") -endforeach(subdir) +endforeach() ### ---[ Documentation add_subdirectory(doc) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 46cba519..0004aa5f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,8 +16,17 @@ the preferred channel for submitting [pull requests](#pull-requests) and [bug reports](#bugs), but please respect the following restrictions: -* Please **do not** use the issue tracker for personal support requests (use - [mailing list](http://www.pcl-users.org/)). +* Please **do not** use the issue tracker for personal support requests. Please + consider one of the following alternatives instead: + * [Stack Overflow](https://stackoverflow.com/questions/tagged/point-cloud-library) + for Q&A as well as support for troubleshooting, installation and debugging. Do + remember to tag your questions with the tag `point-cloud-library`. + * [Gitter channel](https://gitter.im/PointCloudLibrary/pcl) for live chat with + other members of the PCL community and casual discussions + + * Please **do not** derail or troll issues. Keep the discussion on topic and respect the opinions of others. diff --git a/PCLConfig.cmake.in b/PCLConfig.cmake.in index 6fadb595..9f78fcfa 100644 --- a/PCLConfig.cmake.in +++ b/PCLConfig.cmake.in @@ -12,13 +12,16 @@ # www.pointclouds.org #------------------------------------------------------------------------------------ +# Set default policy behavior similar to minimum requirement version +cmake_policy(VERSION 3.5) + +# explicitly set policies we already support in newer cmake versions if(POLICY CMP0074) # TODO: update *_ROOT variables to be PCL_*_ROOT or equivalent. # CMP0074 directly affects how Find* modules work and *_ROOT variables. Since # this is a config file that will be consumed by parent projects with (likely) # NEW behavior, we need to push a policy stack. - cmake_policy(PUSH) - cmake_policy(SET CMP0074 OLD) + cmake_policy(SET CMP0074 NEW) endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules") @@ -36,17 +39,14 @@ macro(pcl_report_not_found _reason) elseif(NOT PCL_FIND_QUIETLY) message(WARNING ${_reason}) endif() - if(POLICY CMP0074) - cmake_policy(POP) - endif() return() -endmacro(pcl_report_not_found) +endmacro() macro(pcl_message) if(NOT PCL_FIND_QUIETLY) message(${ARGN}) - endif(NOT PCL_FIND_QUIETLY) -endmacro(pcl_message) + endif() +endmacro() # Remove duplicate libraries macro(pcl_remove_duplicate_libraries _unfiltered_libraries _filtered_libraries) @@ -76,15 +76,15 @@ macro(pcl_remove_duplicate_libraries _unfiltered_libraries _filtered_libraries) list(APPEND _optimized_libraries ${library}) endif() set(_waiting_for_optimized 0) - else("${library}" STREQUAL "debug") + else() list(FIND _other_libraries "${library}" library_position) if(library_position EQUAL -1) list(APPEND ${_filtered_libraries} ${library}) list(APPEND _other_libraries ${library}) endif() - endif("${library}" STREQUAL "debug") - endforeach(library) -endmacro(pcl_remove_duplicate_libraries) + endif() + endforeach() +endmacro() ### ---[ 3rd party libraries macro(find_boost) @@ -92,29 +92,22 @@ macro(find_boost) set(BOOST_ROOT "${PCL_ROOT}/3rdParty/Boost") elseif(NOT BOOST_INCLUDEDIR) set(BOOST_INCLUDEDIR "@Boost_INCLUDE_DIR@") - endif(PCL_ALL_IN_ONE_INSTALLER) + endif() # use static Boost in Windows if(WIN32) set(Boost_USE_STATIC_LIBS @Boost_USE_STATIC_LIBS@) set(Boost_USE_STATIC @Boost_USE_STATIC@) set(Boost_USE_MULTITHREAD @Boost_USE_MULTITHREAD@) - endif(WIN32) - if(${CMAKE_VERSION} VERSION_LESS 2.8.5) - set(Boost_ADDITIONAL_VERSIONS - "1.47.0" "1.47" "1.46.1" - "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43") - else(${CMAKE_VERSION} VERSION_LESS 2.8.5) - set(Boost_ADDITIONAL_VERSIONS - "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@" - "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" - "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" - "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" - "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" - "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47") - endif(${CMAKE_VERSION} VERSION_LESS 2.8.5) + endif() + set(Boost_ADDITIONAL_VERSIONS + "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@.@Boost_SUBMINOR_VERSION@" "@Boost_MAJOR_VERSION@.@Boost_MINOR_VERSION@" + "1.71.0" "1.71" "1.70.0" "1.70" + "1.69.0" "1.69" "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" + "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" + "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55") # Disable the config mode of find_package(Boost) set(Boost_NO_BOOST_CMAKE ON) - find_package(Boost 1.40.0 ${QUIET_} COMPONENTS @PCLCONFIG_AVAILABLE_BOOST_MODULES@) + find_package(Boost 1.55.0 ${QUIET_} COMPONENTS @PCLCONFIG_AVAILABLE_BOOST_MODULES@) set(BOOST_FOUND ${Boost_FOUND}) set(BOOST_INCLUDE_DIRS "${Boost_INCLUDE_DIR}") @@ -122,8 +115,8 @@ macro(find_boost) set(BOOST_LIBRARIES ${Boost_LIBRARIES}) if(WIN32 AND NOT MINGW) set(BOOST_DEFINITIONS ${BOOST_DEFINITIONS} -DBOOST_ALL_NO_LIB) - endif(WIN32 AND NOT MINGW) -endmacro(find_boost) + endif() +endmacro() #remove this as soon as eigen is shipped with FindEigen.cmake macro(find_eigen) @@ -131,10 +124,10 @@ macro(find_eigen) set(EIGEN_ROOT "${PCL_ROOT}/3rdParty/Eigen") elseif(NOT EIGEN_ROOT) get_filename_component(EIGEN_ROOT "@EIGEN_INCLUDE_DIRS@" ABSOLUTE) - endif(PCL_ALL_IN_ONE_INSTALLER) - find_package(Eigen) + endif() + find_package(Eigen 3.1) set(EIGEN_DEFINITIONS ${EIGEN_DEFINITIONS}) -endmacro(find_eigen) +endmacro() #remove this as soon as qhull is shipped with FindQhull.cmake macro(find_qhull) @@ -142,11 +135,11 @@ macro(find_qhull) set(QHULL_ROOT "${PCL_ROOT}/3rdParty/Qhull") elseif(NOT QHULL_ROOT) get_filename_component(QHULL_ROOT "@QHULL_INCLUDE_DIRS@" PATH) - endif(PCL_ALL_IN_ONE_INSTALLER) + endif() set(QHULL_USE_STATIC @QHULL_USE_STATIC@) find_package(Qhull) -endmacro(find_qhull) +endmacro() #remove this as soon as libopenni is shipped with FindOpenni.cmake macro(find_openni) @@ -160,12 +153,12 @@ macro(find_openni) endif() find_package(OpenNI) -endmacro(find_openni) +endmacro() #remove this as soon as libopenni2 is shipped with FindOpenni2.cmake macro(find_openni2) if(PCL_FIND_QUIETLY) - set(OpenNI2_FIND_QUIETLY TRUE) + set(OpenNI2_FIND_QUIETLY TRUE) endif() if(NOT OPENNI2_ROOT AND ("@HAVE_OPENNI2@" STREQUAL "TRUE")) @@ -174,12 +167,12 @@ macro(find_openni2) endif() find_package(OpenNI2) -endmacro(find_openni2) +endmacro() #remove this as soon as the Ensenso SDK is shipped with FindEnsenso.cmake macro(find_ensenso) if(PCL_FIND_QUIETLY) - set(ensenso_FIND_QUIETLY TRUE) + set(ensenso_FIND_QUIETLY TRUE) endif() if(NOT ENSENSO_ROOT AND ("@HAVE_ENSENSO@" STREQUAL "TRUE")) @@ -187,12 +180,12 @@ macro(find_ensenso) endif() find_package(Ensenso) -endmacro(find_ensenso) +endmacro() #remove this as soon as the davidSDK is shipped with FinddavidSDK.cmake macro(find_davidSDK) if(PCL_FIND_QUIETLY) - set(DAVIDSDK_FIND_QUIETLY TRUE) + set(DAVIDSDK_FIND_QUIETLY TRUE) endif() if(NOT davidSDK_ROOT AND ("@HAVE_DAVIDSDK@" STREQUAL "TRUE")) @@ -200,41 +193,51 @@ macro(find_davidSDK) endif() find_package(davidSDK) -endmacro(find_davidSDK) +endmacro() macro(find_dssdk) if(PCL_FIND_QUIETLY) - set(DSSDK_FIND_QUIETLY TRUE) + set(DSSDK_FIND_QUIETLY TRUE) endif() if(NOT DSSDK_DIR AND ("@HAVE_DSSDK@" STREQUAL "TRUE")) get_filename_component(DSSDK_DIR_HINT "@DSSDK_INCLUDE_DIRS@" PATH) endif() find_package(DSSDK) -endmacro(find_dssdk) +endmacro() macro(find_rssdk) if(PCL_FIND_QUIETLY) - set(RSSDK_FIND_QUIETLY TRUE) + set(RSSDK_FIND_QUIETLY TRUE) endif() if(NOT RSSDK_DIR AND ("@HAVE_RSSDK@" STREQUAL "TRUE")) get_filename_component(RSSDK_DIR_HINT "@RSSDK_INCLUDE_DIRS@" PATH) endif() find_package(RSSDK) -endmacro(find_rssdk) +endmacro() + +macro(find_rssdk2) + if(PCL_ALL_IN_ONE_INSTALLER) + set(realsense2_DIR "${PCL_ROOT}/3rdParty/librealsense2/lib/cmake/realsense2" CACHE PATH "The directory containing realsense2Config.cmake") + elseif(NOT realsense2_DIR) + get_filename_component(realsense2_DIR "@REALSENSE2_INCLUDE_DIRS@" PATH) + set(realsense2_DIR "${realsense2_DIR}/lib/cmake/realsense2" CACHE PATH "The directory containing realsense2Config.cmake") + endif() + find_package(RSSDK2) +endmacro() #remove this as soon as flann is shipped with FindFlann.cmake macro(find_flann) if(PCL_ALL_IN_ONE_INSTALLER) set(FLANN_ROOT "${PCL_ROOT}/3rdParty/Flann") elseif(NOT FLANN_ROOT) - get_filename_component(FLANN_ROOT "@FLANN_INCLUDE_DIRS@" PATH) - endif(PCL_ALL_IN_ONE_INSTALLER) + set(FLANN_ROOT "@FLANN_ROOT@") + endif() set(FLANN_USE_STATIC @FLANN_USE_STATIC@) find_package(FLANN) -endmacro(find_flann) +endmacro() macro(find_VTK) if(PCL_ALL_IN_ONE_INSTALLER AND NOT ANDROID) @@ -245,11 +248,11 @@ macro(find_VTK) endif() elseif(NOT VTK_DIR AND NOT ANDROID) set(VTK_DIR "@VTK_DIR@" CACHE PATH "The directory containing VTKConfig.cmake") - endif(PCL_ALL_IN_ONE_INSTALLER AND NOT ANDROID) + endif() if(NOT ANDROID) - find_package(VTK ${QUIET_}) + find_package(VTK ${QUIET_} COMPONENTS ${PCL_VTK_COMPONENTS}) endif() -endmacro(find_VTK) +endmacro() macro(find_libusb) if(NOT WIN32) @@ -262,12 +265,12 @@ macro(find_libusb) NAMES usb-1.0 PATHS /usr/lib /usr/local/lib /opt/local/lib /sw/lib) find_package_handle_standard_args(libusb-1.0 LIBUSB_1_LIBRARY LIBUSB_1_INCLUDE_DIR) - endif(NOT WIN32) -endmacro(find_libusb) + endif() +endmacro() macro(find_glew) find_package(GLEW) -endmacro(find_glew) +endmacro() # Finds each component external libraries if any # The functioning is as following @@ -303,6 +306,8 @@ macro(find_external_library _component _lib _is_optional) find_dssdk() elseif("${_lib}" STREQUAL "rssdk") find_rssdk() + elseif("${_lib}" STREQUAL "rssdk2") + find_rssdk2() elseif("${_lib}" STREQUAL "vtk") find_VTK() elseif("${_lib}" STREQUAL "libusb-1.0") @@ -311,7 +316,7 @@ macro(find_external_library _component _lib _is_optional) find_glew() elseif("${_lib}" STREQUAL "opengl") find_package(OpenGL) - endif("${_lib}" STREQUAL "boost") + endif() string(TOUPPER "${_component}" COMPONENT) string(TOUPPER "${_lib}" LIB) @@ -320,16 +325,16 @@ macro(find_external_library _component _lib _is_optional) list(APPEND PCL_${COMPONENT}_INCLUDE_DIRS ${${LIB}_INCLUDE_DIRS}) if(${LIB}_USE_FILE) include(${${LIB}_USE_FILE}) - else(${LIB}_USE_FILE) + else() list(APPEND PCL_${COMPONENT}_LIBRARY_DIRS "${${LIB}_LIBRARY_DIRS}") - endif(${LIB}_USE_FILE) + endif() if(${LIB}_LIBRARIES) list(APPEND PCL_${COMPONENT}_LIBRARIES "${${LIB}_LIBRARIES}") - endif(${LIB}_LIBRARIES) + endif() if(${LIB}_DEFINITIONS AND NOT ${LIB} STREQUAL "VTK") list(APPEND PCL_${COMPONENT}_DEFINITIONS ${${LIB}_DEFINITIONS}) - endif(${LIB}_DEFINITIONS AND NOT ${LIB} STREQUAL "VTK") - else(${LIB}_FOUND) + endif() + else() if("${_is_optional}" STREQUAL "OPTIONAL") list(APPEND PCL_${COMPONENT}_DEFINITIONS "-DDISABLE_${LIB}") pcl_message("** WARNING ** ${_component} features related to ${_lib} will be disabled") @@ -341,13 +346,13 @@ macro(find_external_library _component _lib _is_optional) string(TOUPPER "${_component}" COMPONENT) pcl_message("** WARNING ** ${_component} will be disabled cause ${_lib} was not found") list(REMOVE_ITEM PCL_TO_FIND_COMPONENTS ${_component}) - endif((NOT PCL_FIND_ALL) OR (PCL_FIND_ALL EQUAL 1)) - endif("${_is_optional}" STREQUAL "OPTIONAL") - endif(${LIB}_FOUND) -endmacro(find_external_library) + endif() + endif() + endif() +endmacro() macro(pcl_check_external_dependency _component) -endmacro(pcl_check_external_dependency) +endmacro() #flatten dependencies recursivity is great \o/ macro(compute_dependencies TO_FIND_COMPONENTS) @@ -363,27 +368,27 @@ macro(compute_dependencies TO_FIND_COMPONENTS) list(INSERT ${TO_FIND_COMPONENTS} ${pos} ${dependency}) if(pcl_${dependency}_ext_dep) list(APPEND pcl_${component}_ext_dep ${pcl_${dependency}_ext_dep}) - endif(pcl_${dependency}_ext_dep) + endif() if(pcl_${dependency}_opt_dep) list(APPEND pcl_${component}_opt_dep ${pcl_${dependency}_opt_dep}) - endif(pcl_${dependency}_opt_dep) + endif() compute_dependencies(${TO_FIND_COMPONENTS}) - else(${pcl_dependency}_int_dep) + else() list(INSERT ${TO_FIND_COMPONENTS} 0 ${dependency}) - endif(${pcl_dependency}_int_dep) - endif(found EQUAL -1) - endforeach(dependency) - endif(${pcl_component}_int_dep AND (NOT PCL_FIND_ALL)) - endforeach(component) -endmacro(compute_dependencies) + endif() + endif() + endforeach() + endif() + endforeach() +endmacro() ### ---[ Find PCL if(PCL_FIND_QUIETLY) set(QUIET_ QUIET) -else(PCL_FIND_QUIETLY) +else() set(QUIET_) -endif(PCL_FIND_QUIETLY) +endif() find_package(PkgConfig QUIET) @@ -391,37 +396,39 @@ file(TO_CMAKE_PATH "${PCL_DIR}" PCL_DIR) if(WIN32 AND NOT MINGW) # PCLConfig.cmake is installed to PCL_ROOT/cmake get_filename_component(PCL_ROOT "${PCL_DIR}" PATH) -else(WIN32 AND NOT MINGW) +else() # PCLConfig.cmake is installed to PCL_ROOT/share/pcl-x.y get_filename_component(PCL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE) -endif(WIN32 AND NOT MINGW) +endif() # check whether PCLConfig.cmake is found into a PCL installation or in a build tree if(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h") # Found a PCL installation # pcl_message("Found a PCL installation") - set(PCL_INCLUDE_DIRS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}") + set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}") set(PCL_LIBRARY_DIRS "${PCL_ROOT}/@LIB_INSTALL_DIR@") if(EXISTS "${PCL_ROOT}/3rdParty") set(PCL_ALL_IN_ONE_INSTALLER ON) - endif(EXISTS "${PCL_ROOT}/3rdParty") + endif() elseif(EXISTS "${PCL_ROOT}/include/pcl/pcl_config.h") # Found a non-standard (likely ANDROID) PCL installation # pcl_message("Found a PCL installation") - set(PCL_INCLUDE_DIRS "${PCL_ROOT}/include") + set(PCL_CONF_INCLUDE_DIR "${PCL_ROOT}/include") set(PCL_LIBRARY_DIRS "${PCL_ROOT}/lib") if(EXISTS "${PCL_ROOT}/3rdParty") set(PCL_ALL_IN_ONE_INSTALLER ON) - endif(EXISTS "${PCL_ROOT}/3rdParty") + endif() elseif(EXISTS "${PCL_DIR}/include/pcl/pcl_config.h") # Found PCLConfig.cmake in a build tree of PCL # pcl_message("PCL found into a build tree.") - set(PCL_INCLUDE_DIRS "${PCL_DIR}/include") # for pcl_config.h + set(PCL_CONF_INCLUDE_DIR "${PCL_DIR}/include") # for pcl_config.h set(PCL_LIBRARY_DIRS "${PCL_DIR}/@LIB_INSTALL_DIR@") set(PCL_SOURCES_TREE "@CMAKE_SOURCE_DIR@") -else(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h") +else() pcl_report_not_found("PCL can not be found on this machine") -endif(EXISTS "${PCL_ROOT}/include/pcl-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}/pcl/pcl_config.h") +endif() + +set(PCL_INCLUDE_DIRS "${PCL_CONF_INCLUDE_DIR}") #set a suffix for debug libraries set(PCL_DEBUG_SUFFIX "@CMAKE_DEBUG_POSTFIX@") @@ -431,7 +438,7 @@ set(PCL_RELEASE_SUFFIX "@CMAKE_RELEASE_POSTFIX@") list(APPEND PCL_DEFINITIONS @PCLCONFIG_SSE_DEFINITIONS@) list(APPEND PCL_COMPILE_OPTIONS @PCLCONFIG_SSE_COMPILE_OPTIONS@) -set(pcl_all_components @PCLCONFIG_AVAILABLE_COMPONENTS@ ) +set(pcl_all_components @PCLCONFIG_AVAILABLE_COMPONENTS@) list(LENGTH pcl_all_components PCL_NB_COMPONENTS) #list each component dependencies IN PCL @@ -442,7 +449,10 @@ list(LENGTH pcl_all_components PCL_NB_COMPONENTS) @PCLCONFIG_OPTIONAL_DEPENDENCIES@ -set(pcl_header_only_components 2d cuda_common geometry gpu_tracking modeler in_hand_scanner point_cloud_editor cloud_composer optronic_viewer) +# VTK components required by PCL +set(PCL_VTK_COMPONENTS "@PCL_VTK_COMPONENTS@") + +set(pcl_header_only_components 2d cuda_common geometry gpu_tracking modeler in_hand_scanner point_cloud_editor cloud_composer) include(FindPackageHandleStandardArgs) @@ -453,13 +463,13 @@ if(PCL_FIND_COMPONENTS) if(PCL_FIND_COMPONENTS_LENGTH EQUAL PCL_NB_COMPONENTS) set(PCL_TO_FIND_COMPONENTS ${pcl_all_components}) set(PCL_FIND_ALL 1) - else(PCL_FIND_COMPONENTS_LENGTH EQUAL PCL_NB_COMPONENTS) + else() set(PCL_TO_FIND_COMPONENTS ${PCL_FIND_COMPONENTS}) - endif(PCL_FIND_COMPONENTS_LENGTH EQUAL PCL_NB_COMPONENTS) -else(PCL_FIND_COMPONENTS) + endif() +else() set(PCL_TO_FIND_COMPONENTS ${pcl_all_components}) set(PCL_FIND_ALL 1) -endif(PCL_FIND_COMPONENTS) +endif() compute_dependencies(PCL_TO_FIND_COMPONENTS) @@ -475,9 +485,6 @@ set(PCL_TO_FIND_COMPONENTS ${_PCL_TO_FIND_COMPONENTS}) unset(_PCL_TO_FIND_COMPONENTS) if(NOT PCL_TO_FIND_COMPONENTS) - if(POLICY CMP0074) - cmake_policy(POP) - endif() return() endif() @@ -485,11 +492,11 @@ endif() foreach(component ${PCL_TO_FIND_COMPONENTS}) foreach(opt ${pcl_${component}_opt_dep}) find_external_library(${component} ${opt} OPTIONAL) - endforeach(opt) + endforeach() foreach(ext ${pcl_${component}_ext_dep}) find_external_library(${component} ${ext} REQUIRED) - endforeach(ext) -endforeach(component) + endforeach() +endforeach() foreach(component ${PCL_TO_FIND_COMPONENTS}) set(pcl_component pcl_${component}) @@ -518,9 +525,9 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) if(PCL_${COMPONENT}_INCLUDE_DIR) list(APPEND PCL_${COMPONENT}_INCLUDE_DIRS "${PCL_${COMPONENT}_INCLUDE_DIR}") - else(PCL_${COMPONENT}_INCLUDE_DIR) + else() #pcl_message("No include directory found for pcl_${component}.") - endif(PCL_${COMPONENT}_INCLUDE_DIR) + endif() # Skip find_library for header only modules list(FIND pcl_header_only_components ${component} _is_header_only) @@ -544,20 +551,20 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) get_filename_component(${component}_library_path_debug ${PCL_${COMPONENT}_LIBRARY_DEBUG} PATH) - endif(PCL_${COMPONENT}_LIBRARY_DEBUG) + endif() # Restrict this to Windows users if(NOT PCL_${COMPONENT}_LIBRARY AND WIN32) # might be debug only set(PCL_${COMPONENT}_LIBRARY ${PCL_${COMPONENT}_LIBRARY_DEBUG}) - endif(NOT PCL_${COMPONENT}_LIBRARY AND WIN32) + endif() find_package_handle_standard_args(PCL_${COMPONENT} DEFAULT_MSG PCL_${COMPONENT}_LIBRARY PCL_${COMPONENT}_INCLUDE_DIR) - else(_is_header_only EQUAL -1) + else() find_package_handle_standard_args(PCL_${COMPONENT} DEFAULT_MSG PCL_${COMPONENT}_INCLUDE_DIR) - endif(_is_header_only EQUAL -1) + endif() if(PCL_${COMPONENT}_FOUND) if(NOT "${PCL_${COMPONENT}_INCLUDE_DIRS}" STREQUAL "") @@ -570,7 +577,7 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) list(REMOVE_DUPLICATES _filtered) set(PCL_${COMPONENT}_INCLUDE_DIRS ${_filtered}) list(APPEND PCL_INCLUDE_DIRS ${_filtered}) - endif(NOT "${PCL_${COMPONENT}_INCLUDE_DIRS}" STREQUAL "") + endif() mark_as_advanced(PCL_${COMPONENT}_INCLUDE_DIRS) if(_is_header_only EQUAL -1) list(APPEND PCL_DEFINITIONS ${PCL_${COMPONENT}_DEFINITIONS}) @@ -588,9 +595,9 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) list(APPEND PCL_${COMPONENT}_INCLUDE_DIRS ${PCL_${INT_DEP}_INCLUDE_DIRS}) if(PCL_${INT_DEP}_LIBRARIES) list(APPEND PCL_${COMPONENT}_LINK_LIBRARIES "${PCL_${INT_DEP}_LIBRARIES}") - endif(PCL_${INT_DEP}_LIBRARIES) - endif(PCL_${INT_DEP}_FOUND) - endforeach(int_dep) + endif() + endif() + endforeach() if(_is_header_only EQUAL -1) add_library(${pcl_component} @PCL_LIB_TYPE@ IMPORTED) if(PCL_${COMPONENT}_LIBRARY_DEBUG) @@ -609,53 +616,69 @@ foreach(component ${PCL_TO_FIND_COMPONENTS}) IMPORTED_IMPLIB "${PCL_${COMPONENT}_LIBRARY}" ) endif() - foreach(def ${PCL_DEFINITIONS}) - string(REPLACE " " ";" def2 ${def}) - string(REGEX REPLACE "^-D" "" def3 "${def2}") - list(APPEND definitions ${def3}) - endforeach() - if(CMAKE_VERSION VERSION_LESS 3.3) - set_target_properties(${pcl_component} - PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "${definitions}" - INTERFACE_COMPILE_OPTIONS "${PCL_COMPILE_OPTIONS}" - INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${PCL_${COMPONENT}_LINK_LIBRARIES}" - ) - else() - set_target_properties(${pcl_component} - PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "${definitions}" - INTERFACE_COMPILE_OPTIONS "$<$:${PCL_COMPILE_OPTIONS}>" - INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${PCL_${COMPONENT}_LINK_LIBRARIES}" - ) - endif() - set(PCL_${COMPONENT}_LIBRARIES ${pcl_component}) + else() # header-only + add_library(${pcl_component} INTERFACE IMPORTED) endif() - endif(PCL_${COMPONENT}_FOUND) -endforeach(component) + + foreach(def ${PCL_DEFINITIONS}) + string(REPLACE " " ";" def2 ${def}) + string(REGEX REPLACE "^-D" "" def3 "${def2}") + list(APPEND definitions ${def3}) + endforeach() + if(CMAKE_VERSION VERSION_LESS 3.3) + set_target_properties(${pcl_component} + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${definitions}" + INTERFACE_COMPILE_OPTIONS "${PCL_COMPILE_OPTIONS}" + INTERFACE_COMPILE_FEATURES "@PCL_CXX_COMPILE_FEATURES@" + INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS};${PCL_CONF_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${PCL_${COMPONENT}_LINK_LIBRARIES}" + ) + elseif(CMAKE_VERSION VERSION_LESS 3.11) + set_target_properties(${pcl_component} + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${definitions}" + INTERFACE_COMPILE_OPTIONS "$<$:${PCL_COMPILE_OPTIONS}>" + INTERFACE_COMPILE_FEATURES "@PCL_CXX_COMPILE_FEATURES@" + INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS};${PCL_CONF_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${PCL_${COMPONENT}_LINK_LIBRARIES}" + ) + else() + set_target_properties(${pcl_component} + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "${definitions}" + INTERFACE_COMPILE_OPTIONS "$<$:${PCL_COMPILE_OPTIONS}>" + INTERFACE_COMPILE_FEATURES "@PCL_CXX_COMPILE_FEATURES@" + INTERFACE_INCLUDE_DIRECTORIES "${PCL_${COMPONENT}_INCLUDE_DIRS};${PCL_CONF_INCLUDE_DIR}" + ) + # If possible, we use target_link_libraries to avoid problems with link-type keywords, + # see https://github.com/PointCloudLibrary/pcl/issues/2989 + # target_link_libraries on imported libraries is supported only since CMake 3.11 + target_link_libraries(${pcl_component} INTERFACE ${PCL_${COMPONENT}_LINK_LIBRARIES}) + endif() + set(PCL_${COMPONENT}_LIBRARIES ${pcl_component}) + endif() +endforeach() if(NOT "${PCL_INCLUDE_DIRS}" STREQUAL "") list(REMOVE_DUPLICATES PCL_INCLUDE_DIRS) -endif(NOT "${PCL_INCLUDE_DIRS}" STREQUAL "") +endif() if(NOT "${PCL_LIBRARY_DIRS}" STREQUAL "") list(REMOVE_DUPLICATES PCL_LIBRARY_DIRS) -endif(NOT "${PCL_LIBRARY_DIRS}" STREQUAL "") +endif() if(NOT "${PCL_DEFINITIONS}" STREQUAL "") list(REMOVE_DUPLICATES PCL_DEFINITIONS) -endif(NOT "${PCL_DEFINITIONS}" STREQUAL "") +endif() pcl_remove_duplicate_libraries(PCL_COMPONENTS PCL_LIBRARIES) # Add 3rd party libraries, as user code might include our .HPP implementations -list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${OPENNI2_LIBRARIES} ${ENSENSO_LIBRARIES} ${davidSDK_LIBRARIES} ${DSSDK_LIBRARIES} ${RSSDK_LIBRARIES} ${FLANN_LIBRARIES} ${VTK_LIBRARIES}) +list(APPEND PCL_LIBRARIES ${BOOST_LIBRARIES} ${QHULL_LIBRARIES} ${OPENNI_LIBRARIES} ${OPENNI2_LIBRARIES} ${ENSENSO_LIBRARIES} ${davidSDK_LIBRARIES} ${DSSDK_LIBRARIES} ${RSSDK_LIBRARIES} ${RSSDK2_LIBRARIES} ${VTK_LIBRARIES}) +if (TARGET FLANN::FLANN) + list(APPEND PCL_LIBRARIES FLANN::FLANN) +endif() find_package_handle_standard_args(PCL DEFAULT_MSG PCL_LIBRARIES PCL_INCLUDE_DIRS) mark_as_advanced(PCL_LIBRARIES PCL_INCLUDE_DIRS PCL_LIBRARY_DIRS) - -if(POLICY CMP0074) - cmake_policy(POP) -endif() diff --git a/PCLConfigVersion.cmake.in b/PCLConfigVersion.cmake.in index 029804ff..e889ed57 100644 --- a/PCLConfigVersion.cmake.in +++ b/PCLConfigVersion.cmake.in @@ -7,7 +7,7 @@ if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") set(PACKAGE_VERSION_COMPATIBLE FALSE) else() set(PACKAGE_VERSION_COMPATIBLE TRUE) - if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + if("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") set(PACKAGE_VERSION_EXACT TRUE) endif() endif() diff --git a/README.md b/README.md index aaca7bda..55e75e19 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,50 @@ -Continuous integration ----------------------- [![Release][release-image]][releases] [![License][license-image]][license] -[release-image]: https://img.shields.io/badge/release-1.9.1-green.svg?style=flat +[release-image]: https://img.shields.io/badge/release-1.10.0-green.svg?style=flat [releases]: https://github.com/PointCloudLibrary/pcl/releases [license-image]: https://img.shields.io/badge/license-BSD-green.svg?style=flat [license]: https://github.com/PointCloudLibrary/pcl/blob/master/LICENSE.txt -[![Build Status](https://dev.azure.com/PointCloudLibrary/pcl/_apis/build/status/PointCloudLibrary.pcl)](https://dev.azure.com/PointCloudLibrary/pcl/_build/latest?definitionId=1) +Continuous integration +---------------------- + +[![Ubuntu Build Status][ci-ubuntu-image]][ci-ubuntu] [![Windows Build Status][ci-windows-image]][ci-windows] [![MacOS Build Status][ci-macos-image]][ci-macos] + +[ci-ubuntu]: https://dev.azure.com/PointCloudLibrary/pcl/_build/latest?definitionId=4 +[ci-ubuntu-image]: https://img.shields.io/azure-devops/build/PointCloudLibrary/0fc52e87-00b9-420e-acbc-c842c4f2d9cc/4.svg?label=Ubuntu&logo=azure%20pipelines +[ci-windows]: https://dev.azure.com/PointCloudLibrary/pcl/_build/latest?definitionId=3 +[ci-windows-image]: https://img.shields.io/azure-devops/build/PointCloudLibrary/0fc52e87-00b9-420e-acbc-c842c4f2d9cc/3.svg?label=Windows&logo=azure%20pipelines +[ci-macos]: https://dev.azure.com/PointCloudLibrary/pcl/_build/latest?definitionId=2 +[ci-macos-image]: https://img.shields.io/azure-devops/build/PointCloudLibrary/0fc52e87-00b9-420e-acbc-c842c4f2d9cc/2.svg?label=MacOS&logo=azure%20pipelines + +Community +--------- +[![Gitter][gitter-image]][gitter-channel] +[![StackOverflow][so-question-count]][stackoverflow] +[![Website][website-status]][website] + +[gitter-image]: https://img.shields.io/gitter/room/PointCloudLibrary/pcl.svg?label=community%20chat&logo=gitter&logoColor=%23ED1965 +[gitter-channel]: https://gitter.im/PointCloudLibrary/pcl +[website-status]: https://img.shields.io/website/http/www.pointclouds.org.svg?down_color=red&down_message=is%20down&up_color=yellow&up_message=is%20outdated +[website]: http://www.pointclouds.org + +[so-question-count]: https://img.shields.io/stackexchange/stackoverflow/t/point-cloud-library.svg?logo=stackoverflow +[stackoverflow]: https://stackoverflow.com/questions/tagged/point-cloud-library + +Distribution +--------- +[![Packaging status](https://repology.org/badge/tiny-repos/pcl-pointclouds.svg)](https://repology.org/project/pcl-pointclouds/badges) +
+Click to see all +

+ +

+
Description ----------- @@ -39,9 +71,22 @@ Please read [CONTRIBUTING.md](https://github.com/PointCloudLibrary/pcl/blob/mast Issues ------ -For general questions on how to use the PCL, please use the [pcl-users](http://www.pcl-users.org/) mailing list (do not forget to subscribe before posting). To report issues, please read [CONTRIBUTING.md#bug-reports](https://github.com/PointCloudLibrary/pcl/blob/master/CONTRIBUTING.md#bug-reports). +For general questions on how to use the PCL, please consider one of the following alternatives instead: +* [Stack Overflow](https://stackoverflow.com/questions/tagged/point-cloud-library) +for Q&A as well as support for troubleshooting, installation and debugging. Do +remember to tag your questions with the tag `point-cloud-library`. +* [Gitter channel](https://gitter.im/PointCloudLibrary/pcl) for live chat with +other members of the PCL community and casual discussions + + + + diff --git a/apps/3d_rec_framework/CMakeLists.txt b/apps/3d_rec_framework/CMakeLists.txt index c0e0dc15..ec6c56d8 100644 --- a/apps/3d_rec_framework/CMakeLists.txt +++ b/apps/3d_rec_framework/CMakeLists.txt @@ -2,102 +2,133 @@ set(SUBSUBSYS_NAME 3d_rec_framework) set(SUBSUBSYS_DESC "3D recognition framework") set(SUBSUBSYS_DEPS common geometry io filters sample_consensus segmentation visualization kdtree features surface octree registration keypoints tracking search recognition ml) -# Find VTK +# Find VTK if(NOT VTK_FOUND) - set(DEFAULT AUTO_OFF) - set(REASON "VTK was not found.") -else(NOT VTK_FOUND) - set(DEFAULT TRUE) - set(REASON) - include("${VTK_USE_FILE}") -endif(NOT VTK_FOUND) + set(DEFAULT AUTO_OFF) + set(REASON "VTK was not found.") +else() + set(DEFAULT TRUE) + set(REASON) + include("${VTK_USE_FILE}") +endif() # OpenNI found? if(NOT WITH_OPENNI) - set(DEFAULT AUTO_OFF) - set(REASON "OpenNI was not found or was disabled by the user.") + set(DEFAULT AUTO_OFF) + set(REASON "OpenNI was not found or was disabled by the user.") elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT TRUE) - set(REASON) + set(DEFAULT TRUE) + set(REASON) endif() # Default to not building for now -if (${DEFAULT} STREQUAL "TRUE") +if(${DEFAULT} STREQUAL "TRUE") set(DEFAULT FALSE) endif() PCL_SUBSUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" ${DEFAULT} "${REASON}") PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSUBSYS_DEPS} EXT_DEPS vtk openni) -if(build) - - include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") - - set(incs_fw "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/normal_estimator.h") - set(incs_fw_global "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/cvfh_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/vfh_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/esf_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/crh_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/global_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/ourcvfh_estimator.h") - - set(incs_fw_local "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/local_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/fpfh_local_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/fpfh_local_estimator_omp.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/shot_local_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/colorshot_local_estimator.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/shot_local_estimator_omp.h") - set(incs_pc_source "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source/source.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source/mesh_source.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source/registered_views_source.h") - - set(incs_pipelines "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/global_nn_classifier.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/global_nn_recognizer_crh.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/global_nn_recognizer_cvfh.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/local_recognizer.h") - - set(incc_tools_framework "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/openni_frame_source.h") - - set(incs_utils "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils/metrics.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils/persistence_utils.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils/vtk_model_sampling.h") - - set(srcs src/pipeline/global_nn_classifier.cpp - src/pipeline/global_nn_recognizer_crh.cpp - src/pipeline/global_nn_recognizer_cvfh.cpp - src/pipeline/local_recognizer.cpp - src/tools/openni_frame_source.cpp) - - set(impl_incs_pipeline "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/global_nn_classifier.hpp" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/global_nn_recognizer_crh.hpp" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/global_nn_recognizer_cvfh.hpp" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/local_recognizer.hpp") - - # Install include files - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper" ${incs_fw}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global" ${incs_fw_global}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local" ${incs_fw_local}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools" ${incc_tools_framework}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline" ${incs_pipelines}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source" ${incs_pc_source}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils" ${incs_utils}) - - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl" ${impl_incs_pipeline}) - - set(LIB_NAME "pcl_${SUBSUBSYS_NAME}") - PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSUBSYS_NAME}" ${srcs} ${impl_incs_pipeline} ${incs_utils} ${incs_fw} ${incs_fw_global} ${incs_fw_local} ${incc_tools_framework} ${incs_pipelines} ${incs_pc_source}) - target_link_libraries("${LIB_NAME}" pcl_apps pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search) - - if(WITH_OPENNI) - target_link_libraries("${LIB_NAME}" ${OPENNI_LIBRARIES}) - if(NOT WIN32) - find_package(libusb-1.0 REQUIRED) - target_link_libraries("${LIB_NAME}" ${LIBUSB_1_LIBRARIES}) - endif() +if(NOT build) + return() +endif() + +include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") + +set(incs_fw + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/normal_estimator.h" +) + +set(incs_fw_global + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/cvfh_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/vfh_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/esf_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/crh_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/global_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global/ourcvfh_estimator.h" +) + +set(incs_fw_local + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/local_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/fpfh_local_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/fpfh_local_estimator_omp.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/shot_local_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/colorshot_local_estimator.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local/shot_local_estimator_omp.h" +) + +set(incs_pc_source + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source/source.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source/mesh_source.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source/registered_views_source.h" +) + +set(incs_pipelines + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/global_nn_classifier.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/global_nn_recognizer_crh.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/global_nn_recognizer_cvfh.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/local_recognizer.h" +) + +set(incc_tools_framework + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/openni_frame_source.h" +) + +set(incs_utils + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils/metrics.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils/persistence_utils.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils/vtk_model_sampling.h" +) + +set(srcs + src/pipeline/global_nn_classifier.cpp + src/pipeline/global_nn_recognizer_crh.cpp + src/pipeline/global_nn_recognizer_cvfh.cpp + src/pipeline/local_recognizer.cpp + src/tools/openni_frame_source.cpp +) + +set(impl_incs_pipeline + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/global_nn_classifier.hpp" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/global_nn_recognizer_crh.hpp" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/global_nn_recognizer_cvfh.hpp" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl/local_recognizer.hpp" +) + +# Install include files +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper" ${incs_fw}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/global" ${incs_fw_global}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/feature_wrapper/local" ${incs_fw_local}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools" ${incc_tools_framework}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline" ${incs_pipelines}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pc_source" ${incs_pc_source}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils" ${incs_utils}) + +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}/pipeline/impl" ${impl_incs_pipeline}) + +set(LIB_NAME "pcl_${SUBSUBSYS_NAME}") +PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSUBSYS_NAME} SOURCES ${srcs} ${impl_incs_pipeline} ${incs_utils} ${incs_fw} ${incs_fw_global} ${incs_fw_local} ${incc_tools_framework} ${incs_pipelines} ${incs_pc_source}) +target_link_libraries("${LIB_NAME}" pcl_apps pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search) + +if(WITH_OPENNI) + target_link_libraries("${LIB_NAME}" ${OPENNI_LIBRARIES}) + if(NOT WIN32) + find_package(libusb-1.0 REQUIRED) + target_link_libraries("${LIB_NAME}" ${LIBUSB_1_LIBRARIES}) endif() - - PCL_MAKE_PKGCONFIG("${LIB_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "") - - add_subdirectory(tools) +endif() + +PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSUBSYS_NAME} DESC ${SUBSUBSYS_DESC}) + +if(QHULL_FOUND) + add_executable(pcl_global_classification src/tools/global_classification.cpp) + target_link_libraries(pcl_global_classification pcl_apps pcl_3d_rec_framework pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface) +endif() + +PCL_ADD_EXECUTABLE(pcl_local_or_mian COMPONENT ${SUBSUBSYS_NAME} SOURCES src/tools/local_recognition_mian_dataset.cpp) +target_link_libraries(pcl_local_or_mian pcl_apps pcl_3d_rec_framework pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints) -endif(build) +# Add to the compound apps target +string(TOUPPER ${SUBSUBSYS_NAME} SUBSUBSYS_NAME_UPPER) +list(APPEND PCL_APPS_ALL_TARGETS ${PCL_${SUBSUBSYS_NAME_UPPER}_ALL_TARGETS}) +set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE) diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/crh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/crh_estimator.h index 9cb2799d..1517b179 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/crh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/crh_estimator.h @@ -5,13 +5,14 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_CRH_ESTIMATOR_H_ -#define REC_FRAMEWORK_CRH_ESTIMATOR_H_ +#pragma once #include #include #include +#include + namespace pcl { namespace rec_3d_framework @@ -20,12 +21,12 @@ namespace pcl class CRHEstimation : public GlobalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; using GlobalEstimator::normal_estimator_; using GlobalEstimator::normals_; - typename boost::shared_ptr > feature_estimator_; - typedef pcl::PointCloud > CRHPointCloud; + std::shared_ptr> feature_estimator_; + using CRHPointCloud = pcl::PointCloud >; std::vector< CRHPointCloud::Ptr > crh_histograms_; public: @@ -36,14 +37,14 @@ namespace pcl } void - setFeatureEstimator(typename boost::shared_ptr > & feature_estimator) { + setFeatureEstimator(std::shared_ptr>& feature_estimator) { feature_estimator_ = feature_estimator; } void estimate (PointInTPtr & in, PointInTPtr & processed, std::vector, Eigen::aligned_allocator > > & signatures, - std::vector > & centroids) + std::vector > & centroids) override { if (!feature_estimator_) @@ -63,12 +64,12 @@ namespace pcl crh_histograms_.resize(signatures.size()); - typedef typename pcl::CRHEstimation > CRHEstimation; + using CRHEstimation = pcl::CRHEstimation >; CRHEstimation crh; crh.setInputCloud(processed); crh.setInputNormals(normals_); - for (size_t idx = 0; idx < signatures.size (); idx++) + for (std::size_t idx = 0; idx < signatures.size (); idx++) { Eigen::Vector4f centroid4f(centroids[idx][0],centroids[idx][1],centroids[idx][2],0); crh.setCentroid(centroid4f); @@ -83,12 +84,10 @@ namespace pcl } bool - computedNormals () + computedNormals () override { return true; } }; } } - -#endif /* REC_FRAMEWORK_CVFH_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h index ec72062d..50469cd7 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/cvfh_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_CVFH_ESTIMATOR_H_ -#define REC_FRAMEWORK_CVFH_ESTIMATOR_H_ +#pragma once #include #include @@ -21,7 +20,7 @@ namespace pcl class CVFHEstimation : public GlobalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; using GlobalEstimator::normal_estimator_; using GlobalEstimator::normals_; float eps_angle_threshold_; @@ -53,7 +52,7 @@ namespace pcl void estimate (PointInTPtr & in, PointInTPtr & processed, typename pcl::PointCloud::CloudVectorType & signatures, - std::vector > & centroids) + std::vector > & centroids) override { if (!normal_estimator_) @@ -98,7 +97,7 @@ namespace pcl /*normals_.reset(new pcl::PointCloud); normal_estimator_->estimate (in, processed, normals_);*/ - typedef typename pcl::CVFHEstimation CVFHEstimation; + using CVFHEstimation = pcl::CVFHEstimation; pcl::PointCloud cvfh_signatures; typename pcl::search::KdTree::Ptr cvfh_tree (new pcl::search::KdTree); @@ -134,7 +133,7 @@ namespace pcl cvfh.compute (cvfh_signatures); - for (size_t i = 0; i < cvfh_signatures.points.size (); i++) + for (std::size_t i = 0; i < cvfh_signatures.points.size (); i++) { pcl::PointCloud vfh_signature; vfh_signature.points.resize (1); @@ -151,7 +150,7 @@ namespace pcl } bool - computedNormals () + computedNormals () override { return true; } @@ -162,5 +161,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_CVFH_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/esf_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/esf_estimator.h index 2811f31c..ac759442 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/esf_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/esf_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_ESF_ESTIMATOR_H_ -#define REC_FRAMEWORK_ESF_ESTIMATOR_H_ +#pragma once #include #include @@ -19,16 +18,16 @@ namespace pcl class ESFEstimation : public GlobalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; public: void estimate (PointInTPtr & in, PointInTPtr & processed, typename pcl::PointCloud::CloudVectorType & signatures, - std::vector > & centroids) + std::vector > & centroids) override { - typedef typename pcl::ESFEstimation ESFEstimation; + using ESFEstimation = pcl::ESFEstimation; pcl::PointCloud ESF_signature; ESFEstimation esf; @@ -49,12 +48,10 @@ namespace pcl } bool - computedNormals () + computedNormals () override { return false; } }; } } - -#endif /* REC_FRAMEWORK_ESF_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/global_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/global_estimator.h index 6bc63044..badf27c0 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/global_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/global_estimator.h @@ -5,11 +5,12 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_GLOBAL_ESTIMATOR_H_ -#define REC_FRAMEWORK_GLOBAL_ESTIMATOR_H_ +#pragma once #include +#include + namespace pcl { namespace rec_3d_framework @@ -18,21 +19,24 @@ namespace pcl class GlobalEstimator { protected: bool computed_normals_; - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr FeatureTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using FeatureTPtr = typename pcl::PointCloud::Ptr; - typename boost::shared_ptr > normal_estimator_; + std::shared_ptr> normal_estimator_; pcl::PointCloud::Ptr normals_; public: + virtual + ~GlobalEstimator() = default; + virtual void estimate (PointInTPtr & in, PointInTPtr & processed, std::vector, Eigen::aligned_allocator< pcl::PointCloud > > & signatures, std::vector > & centroids)=0; virtual bool computedNormals() = 0; - void setNormalEstimator(boost::shared_ptr > & ne) { + void setNormalEstimator(std::shared_ptr>& ne) { normal_estimator_ = ne; } @@ -43,6 +47,3 @@ namespace pcl }; } } - - -#endif /* REC_FRAMEWORK_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h index c9b7ef2d..3d99e6ff 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/ourcvfh_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_OURCVFH_ESTIMATOR_H_ -#define REC_FRAMEWORK_OURCVFH_ESTIMATOR_H_ +#pragma once #include #include @@ -22,7 +21,7 @@ namespace pcl { protected: - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; using GlobalEstimator::normal_estimator_; using GlobalEstimator::normals_; float eps_angle_threshold_; @@ -79,9 +78,9 @@ namespace pcl trans = transforms_; } - virtual void + void estimate (PointInTPtr & in, PointInTPtr & processed, typename pcl::PointCloud::CloudVectorType & signatures, - std::vector > & centroids) + std::vector > & centroids) override { valid_roll_transforms_.clear (); @@ -131,7 +130,7 @@ namespace pcl /*normals_.reset(new pcl::PointCloud); normal_estimator_->estimate (in, processed, normals_);*/ - typedef typename pcl::OURCVFHEstimation OURCVFHEstimation; + using OURCVFHEstimation = pcl::OURCVFHEstimation; pcl::PointCloud cvfh_signatures; typename pcl::search::KdTree::Ptr cvfh_tree (new pcl::search::KdTree); @@ -166,13 +165,13 @@ namespace pcl //std::cout << "Res:" << normal_estimator_->mesh_resolution_ << " Radius normals:" << radius << " Cluster tolerance:" << cluster_tolerance_radius << " " << eps_angle_threshold_ << " " << curvature_threshold_ << std::endl; - for (size_t i = 0; i < cvfh_signatures.points.size (); i++) + for (const auto &point : cvfh_signatures.points) { pcl::PointCloud vfh_signature; vfh_signature.points.resize (1); vfh_signature.width = vfh_signature.height = 1; for (int d = 0; d < 308; ++d) - vfh_signature.points[0].histogram[d] = cvfh_signatures.points[i].histogram[d]; + vfh_signature.points[0].histogram[d] = point.histogram[d]; signatures.push_back (vfh_signature); } @@ -184,7 +183,7 @@ namespace pcl } bool - computedNormals () + computedNormals () override { return true; } @@ -197,5 +196,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_OURCVFH_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/vfh_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/vfh_estimator.h index e3efc962..2ad9e378 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/vfh_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/global/vfh_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_VFH_ESTIMATOR_H_ -#define REC_FRAMEWORK_VFH_ESTIMATOR_H_ +#pragma once #include #include @@ -20,7 +19,7 @@ namespace pcl class VFHEstimation : public GlobalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; using GlobalEstimator::normal_estimator_; using GlobalEstimator::normals_; @@ -28,7 +27,7 @@ namespace pcl void estimate (PointInTPtr & in, PointInTPtr & processed, typename pcl::PointCloud::CloudVectorType & signatures, - std::vector > & centroids) + std::vector > & centroids) override { if (!normal_estimator_) @@ -40,7 +39,7 @@ namespace pcl normals_.reset(new pcl::PointCloud); normal_estimator_->estimate (in, processed, normals_); - typedef typename pcl::VFHEstimation VFHEstimation; + using VFHEstimation = pcl::VFHEstimation; pcl::PointCloud vfh_signature; VFHEstimation vfh; @@ -64,12 +63,10 @@ namespace pcl } bool - computedNormals () + computedNormals () override { return true; } }; } } - -#endif /* REC_FRAMEWORK_VFH_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/colorshot_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/colorshot_local_estimator.h index cb7f619f..506bf63d 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/colorshot_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/colorshot_local_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_COLORSHOT_LOCAL_ESTIMATOR_H_ -#define REC_FRAMEWORK_COLORSHOT_LOCAL_ESTIMATOR_H_ +#pragma once #include #include @@ -21,8 +20,8 @@ namespace pcl class ColorSHOTLocalEstimation : public LocalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr FeatureTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using FeatureTPtr = typename pcl::PointCloud::Ptr; using LocalEstimator::support_radius_; using LocalEstimator::normal_estimator_; @@ -62,7 +61,7 @@ namespace pcl } //compute signatures - typedef typename pcl::SHOTColorEstimation SHOTEstimator; + using SHOTEstimator = pcl::SHOTColorEstimation; typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); pcl::PointCloud::Ptr shots (new pcl::PointCloud); @@ -79,7 +78,7 @@ namespace pcl int size_feat = sizeof(signatures->points[0].histogram) / sizeof(float); - for (size_t k = 0; k < shots->points.size (); k++) + for (std::size_t k = 0; k < shots->points.size (); k++) for (int i = 0; i < size_feat; i++) signatures->points[k].histogram[i] = shots->points[k].descriptor[i]; @@ -90,5 +89,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_COLORSHOT_LOCAL_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h index 61423c0b..dfc8f943 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_FPFH_LOCAL_ESTIMATOR_H_ -#define REC_FRAMEWORK_FPFH_LOCAL_ESTIMATOR_H_ +#pragma once #include #include @@ -20,9 +19,9 @@ namespace pcl class FPFHLocalEstimation : public LocalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr FeatureTPtr; - typedef pcl::PointCloud KeypointCloud; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using FeatureTPtr = typename pcl::PointCloud::Ptr; + using KeypointCloud = pcl::PointCloud; using LocalEstimator::support_radius_; using LocalEstimator::normal_estimator_; @@ -30,7 +29,7 @@ namespace pcl public: bool - estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures) + estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures) override { if (!normal_estimator_) @@ -39,7 +38,7 @@ namespace pcl return false; } - if (keypoint_extractor_.size() == 0) + if (keypoint_extractor_.empty ()) { PCL_ERROR("FPFHLocalEstimation :: This feature needs a keypoint extractor... please provide one\n"); return false; @@ -52,7 +51,7 @@ namespace pcl this->computeKeypoints(processed, keypoints, normals); std::cout << " " << normals->points.size() << " " << processed->points.size() << std::endl; - if (keypoints->points.size () == 0) + if (keypoints->points.empty ()) { PCL_WARN("FPFHLocalEstimation :: No keypoints were found\n"); return false; @@ -61,7 +60,7 @@ namespace pcl assert (processed->points.size () == normals->points.size ()); //compute signatures - typedef typename pcl::FPFHEstimation FPFHEstimator; + using FPFHEstimator = pcl::FPFHEstimation; typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); pcl::PointCloud::Ptr fpfhs (new pcl::PointCloud); @@ -78,7 +77,7 @@ namespace pcl signatures->height = 1; int size_feat = 33; - for (size_t k = 0; k < fpfhs->points.size (); k++) + for (std::size_t k = 0; k < fpfhs->points.size (); k++) for (int i = 0; i < size_feat; i++) signatures->points[k].histogram[i] = fpfhs->points[k].histogram[i]; @@ -89,5 +88,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_FPFH_LOCAL_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator_omp.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator_omp.h index 1bdf3ea0..83efea13 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator_omp.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/fpfh_local_estimator_omp.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_FPFH_LOCAL_ESTIMATOR_OMP_H_ -#define REC_FRAMEWORK_FPFH_LOCAL_ESTIMATOR_OMP_H_ +#pragma once #include #include @@ -20,9 +19,9 @@ namespace pcl class FPFHLocalEstimationOMP : public LocalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr FeatureTPtr; - typedef pcl::PointCloud KeypointCloud; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using FeatureTPtr = typename pcl::PointCloud::Ptr; + using KeypointCloud = pcl::PointCloud; using LocalEstimator::support_radius_; using LocalEstimator::normal_estimator_; @@ -62,7 +61,7 @@ namespace pcl assert (processed->points.size () == normals->points.size ()); //compute signatures - typedef typename pcl::FPFHEstimationOMP FPFHEstimator; + using FPFHEstimator = pcl::FPFHEstimationOMP; typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); pcl::PointCloud::Ptr fpfhs (new pcl::PointCloud); @@ -80,7 +79,7 @@ namespace pcl signatures->height = 1; int size_feat = 33; - for (size_t k = 0; k < fpfhs->points.size (); k++) + for (std::size_t k = 0; k < fpfhs->points.size (); k++) for (int i = 0; i < size_feat; i++) signatures->points[k].histogram[i] = fpfhs->points[k].histogram[i]; @@ -91,5 +90,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_FPFH_LOCAL_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h index a5b23b95..e88d8122 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/local_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_LOCAL_ESTIMATOR_H_ -#define REC_FRAMEWORK_LOCAL_ESTIMATOR_H_ +#pragma once #include #include @@ -15,6 +14,8 @@ #include #include +#include + namespace pcl { template<> @@ -37,12 +38,15 @@ namespace pcl class KeypointExtractor { protected: - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr PointOutTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using PointOutTPtr = typename pcl::PointCloud::Ptr; typename pcl::PointCloud::Ptr input_; float radius_; public: + virtual + ~KeypointExtractor() = default; + void setInputCloud (PointInTPtr & input) { @@ -76,13 +80,13 @@ namespace pcl class UniformSamplingExtractor : public KeypointExtractor { private: - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; bool filter_planar_; using KeypointExtractor::input_; using KeypointExtractor::radius_; float sampling_density_; - boost::shared_ptr > > neighborhood_indices_; - boost::shared_ptr > > neighborhood_dist_; + std::shared_ptr>> neighborhood_indices_; + std::shared_ptr>> neighborhood_dist_; void filterPlanar (PointInTPtr & input, PointInTPtr & keypoints_cloud) @@ -104,7 +108,7 @@ namespace pcl filtered_keypoints.points.resize (keypoints_cloud->points.size ()); int good = 0; - for (size_t i = 0; i < keypoints_cloud->points.size (); i++) + for (std::size_t i = 0; i < keypoints_cloud->points.size (); i++) { if (tree->radiusSearch (keypoints_cloud->points[i], radius_, (*neighborhood_indices_)[good], (*neighborhood_dist_)[good])) @@ -120,12 +124,12 @@ namespace pcl pcl::eigen33 (covariance_matrix, eigenVectors, eigenValues); float eigsum = eigenValues.sum (); - if (!pcl_isfinite(eigsum)) + if (!std::isfinite(eigsum)) { PCL_ERROR("Eigen sum is not finite\n"); } - if ((fabs (eigenValues[0] - eigenValues[1]) < 1.5e-4) || (eigsum != 0 && fabs (eigenValues[0] / eigsum) > 1.e-2)) + if ((std::abs (eigenValues[0] - eigenValues[1]) < 1.5e-4) || (eigsum != 0 && std::abs (eigenValues[0] / eigsum) > 1.e-2)) { //region is not planar, add to filtered keypoint keypoints_cloud->points[good] = keypoints_cloud->points[i]; @@ -158,7 +162,7 @@ namespace pcl } void - compute (PointInTPtr & keypoints) + compute (PointInTPtr & keypoints) override { keypoints.reset (new pcl::PointCloud); @@ -176,7 +180,7 @@ namespace pcl template class SIFTKeypointExtractor : public KeypointExtractor { - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; using KeypointExtractor::input_; using KeypointExtractor::radius_; @@ -200,7 +204,7 @@ namespace pcl template class SIFTSurfaceKeypointExtractor : public KeypointExtractor { - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; pcl::PointCloud::Ptr normals_; using KeypointExtractor::input_; using KeypointExtractor::radius_; @@ -230,7 +234,7 @@ namespace pcl input_cloud->width = input_->width; input_cloud->height = input_->height; input_cloud->points.resize (input_->width * input_->height); - for (size_t i = 0; i < input_->points.size (); i++) + for (std::size_t i = 0; i < input_->points.size (); i++) { input_cloud->points[i].getVector3fMap () = input_->points[i].getVector3fMap (); input_cloud->points[i].getNormalVector3fMap () = normals_->points[i].getNormalVector3fMap (); @@ -252,7 +256,7 @@ namespace pcl { pcl::PointCloud::Ptr normals_; - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; using KeypointExtractor::input_; using KeypointExtractor::radius_; typename pcl::HarrisKeypoint3D::ResponseMethod m_; @@ -326,7 +330,7 @@ namespace pcl { pcl::PointCloud::Ptr normals_; - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; using KeypointExtractor::input_; using KeypointExtractor::radius_; @@ -375,28 +379,24 @@ namespace pcl class LocalEstimator { protected: - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr FeatureTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using FeatureTPtr = typename pcl::PointCloud::Ptr; - typename boost::shared_ptr > normal_estimator_; - //typename boost::shared_ptr > keypoint_extractor_; - std::vector > > keypoint_extractor_; //this should be a vector + std::shared_ptr> normal_estimator_; + std::vector>> keypoint_extractor_; //this should be a vector float support_radius_; //bool filter_planar_; bool adaptative_MLS_; - boost::shared_ptr > > neighborhood_indices_; - boost::shared_ptr > > neighborhood_dist_; - - //std::vector< std::vector > neighborhood_indices_; - //std::vector< std::vector > neighborhood_dist_; + std::shared_ptr>> neighborhood_indices_; + std::shared_ptr>> neighborhood_dist_; void computeKeypoints (PointInTPtr & cloud, PointInTPtr & keypoints, pcl::PointCloud::Ptr & normals) { keypoints.reset (new pcl::PointCloud); - for (size_t i = 0; i < keypoint_extractor_.size (); i++) + for (std::size_t i = 0; i < keypoint_extractor_.size (); i++) { keypoint_extractor_[i]->setInputCloud (cloud); if (keypoint_extractor_[i]->needNormals ()) @@ -418,6 +418,9 @@ namespace pcl keypoint_extractor_.clear (); } + virtual + ~LocalEstimator() = default; + void setAdaptativeMLS (bool b) { @@ -428,7 +431,7 @@ namespace pcl estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures)=0; void - setNormalEstimator (boost::shared_ptr > & ne) + setNormalEstimator (std::shared_ptr> & ne) { normal_estimator_ = ne; } @@ -437,13 +440,13 @@ namespace pcl * \brief Right now only uniformSampling keypoint extractor is allowed */ void - addKeypointExtractor (boost::shared_ptr > & ke) + addKeypointExtractor (std::shared_ptr>& ke) { keypoint_extractor_.push_back (ke); } void - setKeypointExtractors (std::vector > > & ke) + setKeypointExtractors (std::vector>>& ke) { keypoint_extractor_ = ke; } @@ -454,73 +457,6 @@ namespace pcl support_radius_ = r; } - /*void - setFilterPlanar (bool b) - { - filter_planar_ = b; - } - - void - filterPlanar (PointInTPtr & input, KeypointCloud & keypoints_cloud) - { - pcl::PointCloud filtered_keypoints; - //create a search object - typename pcl::search::Search::Ptr tree; - if (input->isOrganized ()) - tree.reset (new pcl::search::OrganizedNeighbor ()); - else - tree.reset (new pcl::search::KdTree (false)); - tree->setInputCloud (input); - - //std::vector nn_indices; - //std::vector nn_distances; - - neighborhood_indices_.reset (new std::vector >); - neighborhood_indices_->resize (keypoints_cloud.points.size ()); - neighborhood_dist_.reset (new std::vector >); - neighborhood_dist_->resize (keypoints_cloud.points.size ()); - - filtered_keypoints.points.resize (keypoints_cloud.points.size ()); - int good = 0; - - //#pragma omp parallel for num_threads(8) - for (size_t i = 0; i < keypoints_cloud.points.size (); i++) - { - - if (tree->radiusSearch (keypoints_cloud[i], support_radius_, (*neighborhood_indices_)[good], (*neighborhood_dist_)[good])) - { - - EIGEN_ALIGN16 Eigen::Matrix3f covariance_matrix; - Eigen::Vector4f xyz_centroid; - EIGEN_ALIGN16 Eigen::Vector3f eigenValues; - EIGEN_ALIGN16 Eigen::Matrix3f eigenVectors; - - //compute planarity of the region - computeMeanAndCovarianceMatrix (*input, (*neighborhood_indices_)[good], covariance_matrix, xyz_centroid); - pcl::eigen33 (covariance_matrix, eigenVectors, eigenValues); - - float eigsum = eigenValues.sum (); - if (!pcl_isfinite(eigsum)) - { - PCL_ERROR("Eigen sum is not finite\n"); - } - - if ((fabs (eigenValues[0] - eigenValues[1]) < 1.5e-4) || (eigsum != 0 && fabs (eigenValues[0] / eigsum) > 1.e-2)) - { - //region is not planar, add to filtered keypoint - keypoints_cloud.points[good] = keypoints_cloud.points[i]; - good++; - } - } - } - - neighborhood_indices_->resize (good); - neighborhood_dist_->resize (good); - keypoints_cloud.points.resize (good); - }*/ - }; } } - -#endif /* REC_FRAMEWORK_LOCAL_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h index 74e5f635..06f5cc06 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_SHOT_LOCAL_ESTIMATOR_H_ -#define REC_FRAMEWORK_SHOT_LOCAL_ESTIMATOR_H_ +#pragma once #include #include @@ -21,8 +20,8 @@ namespace pcl class SHOTLocalEstimation : public LocalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr FeatureTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using FeatureTPtr = typename pcl::PointCloud::Ptr; using LocalEstimator::support_radius_; using LocalEstimator::normal_estimator_; @@ -31,7 +30,7 @@ namespace pcl public: bool - estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures) + estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures) override { if (!normal_estimator_) @@ -40,7 +39,7 @@ namespace pcl return false; } - if (keypoint_extractor_.size() == 0) + if (keypoint_extractor_.empty ()) { PCL_ERROR("SHOTLocalEstimation :: This feature needs a keypoint extractor... please provide one\n"); return false; @@ -100,7 +99,7 @@ namespace pcl keypoint_extractor_->setSupportRadius(support_radius_); keypoint_extractor_->compute (keypoints);*/ - if (keypoints->points.size () == 0) + if (keypoints->points.empty ()) { PCL_WARN("SHOTLocalEstimation :: No keypoints were found\n"); return false; @@ -108,7 +107,7 @@ namespace pcl std::cout << keypoints->points.size() << " " << normals->points.size() << " " << processed->points.size() << std::endl; //compute signatures - typedef typename pcl::SHOTEstimation SHOTEstimator; + using SHOTEstimator = pcl::SHOTEstimation; typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); pcl::PointCloud::Ptr shots (new pcl::PointCloud); @@ -126,7 +125,7 @@ namespace pcl int size_feat = sizeof(signatures->points[0].histogram) / sizeof(float); - for (size_t k = 0; k < shots->points.size (); k++) + for (std::size_t k = 0; k < shots->points.size (); k++) for (int i = 0; i < size_feat; i++) signatures->points[k].histogram[i] = shots->points[k].descriptor[i]; @@ -140,5 +139,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_SHOT_LOCAL_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h index 4c52786f..a0f1282e 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/local/shot_local_estimator_omp.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_SHOT_LOCAL_ESTIMATOR_OMP_H_ -#define REC_FRAMEWORK_SHOT_LOCAL_ESTIMATOR_OMP_H_ +#pragma once #include #include @@ -21,9 +20,9 @@ namespace pcl class SHOTLocalEstimationOMP : public LocalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::Ptr FeatureTPtr; - typedef pcl::PointCloud KeypointCloud; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using FeatureTPtr = typename pcl::PointCloud::Ptr; + using KeypointCloud = pcl::PointCloud; using LocalEstimator::support_radius_; using LocalEstimator::normal_estimator_; @@ -34,7 +33,7 @@ namespace pcl public: bool - estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures) + estimate (PointInTPtr & in, PointInTPtr & processed, PointInTPtr & keypoints, FeatureTPtr & signatures) override { if (!normal_estimator_) { @@ -42,7 +41,7 @@ namespace pcl return false; } - if (keypoint_extractor_.size() == 0) + if (keypoint_extractor_.empty ()) { PCL_ERROR("SHOTLocalEstimationOMP :: This feature needs a keypoint extractor... please provide one\n"); return false; @@ -89,14 +88,14 @@ namespace pcl this->computeKeypoints(processed, keypoints, normals); std::cout << " " << normals->points.size() << " " << processed->points.size() << std::endl; - if (keypoints->points.size () == 0) + if (keypoints->points.empty ()) { PCL_WARN("SHOTLocalEstimationOMP :: No keypoints were found\n"); return false; } //compute signatures - typedef typename pcl::SHOTEstimationOMP SHOTEstimator; + using SHOTEstimator = pcl::SHOTEstimationOMP; typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); tree->setInputCloud (processed); @@ -121,13 +120,13 @@ namespace pcl int size_feat = sizeof(signatures->points[0].histogram) / sizeof(float); int good = 0; - for (size_t k = 0; k < shots->points.size (); k++) + for (const auto &point : shots->points) { int NaNs = 0; for (int i = 0; i < size_feat; i++) { - if (!pcl_isfinite(shots->points[k].descriptor[i])) + if (!std::isfinite(point.descriptor[i])) NaNs++; } @@ -135,7 +134,7 @@ namespace pcl { for (int i = 0; i < size_feat; i++) { - signatures->points[good].histogram[i] = shots->points[k].descriptor[i]; + signatures->points[good].histogram[i] = point.descriptor[i]; } good++; @@ -152,5 +151,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_SHOT_LOCAL_ESTIMATOR_OMP_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h index 4399dfb0..775e668d 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/feature_wrapper/normal_estimator.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_NORMAL_ESTIMATOR_H_ -#define REC_FRAMEWORK_NORMAL_ESTIMATOR_H_ +#pragma once #include #include @@ -22,12 +21,12 @@ namespace pcl class PreProcessorAndNormalEstimator { - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; float computeMeshResolution (PointInTPtr & input) { - typedef typename pcl::KdTree::Ptr KdTreeInPtr; + using KdTreeInPtr = typename pcl::KdTree::Ptr; KdTreeInPtr tree = boost::make_shared > (false); tree->setInputCloud (input); @@ -38,12 +37,12 @@ namespace pcl float sum_distances = 0.0; std::vector avg_distances (input->points.size ()); // Iterate through the source data set - for (size_t i = 0; i < input->points.size (); ++i) + for (std::size_t i = 0; i < input->points.size (); ++i) { tree->nearestKSearch (input->points[i], 9, nn_indices, nn_distances); float avg_dist_neighbours = 0.0; - for (size_t j = 1; j < nn_indices.size (); j++) + for (std::size_t j = 1; j < nn_indices.size (); j++) avg_dist_neighbours += std::sqrt (nn_distances[j]); avg_dist_neighbours /= static_cast (nn_indices.size ()); @@ -138,7 +137,7 @@ namespace pcl out = in; } - if (out->points.size () == 0) + if (out->points.empty ()) { PCL_WARN("NORMAL estimator: Cloud has no points after voxel grid, won't be able to compute normals!\n"); return; @@ -168,7 +167,7 @@ namespace pcl } - if (out->points.size () == 0) + if (out->points.empty ()) { PCL_WARN("NORMAL estimator: Cloud has no points after removing outliers...!\n"); return; @@ -184,8 +183,7 @@ namespace pcl if (out->isOrganized ()) { - typedef typename pcl::IntegralImageNormalEstimation NormalEstimator_; - NormalEstimator_ n3d; + pcl::IntegralImageNormalEstimation n3d; n3d.setNormalEstimationMethod (n3d.COVARIANCE_MATRIX); //n3d.setNormalEstimationMethod (n3d.AVERAGE_3D_GRADIENT); n3d.setInputCloud (out); @@ -205,9 +203,9 @@ namespace pcl { pcl::ScopeTime t ("check nans..."); int j = 0; - for (size_t i = 0; i < out->points.size (); ++i) + for (std::size_t i = 0; i < out->points.size (); ++i) { - if (!pcl_isfinite (out->points[i].x) || !pcl_isfinite (out->points[i].y) || !pcl_isfinite (out->points[i].z)) + if (!std::isfinite (out->points[i].x) || !std::isfinite (out->points[i].y) || !std::isfinite (out->points[i].z)) continue; out->points[j] = out->points[i]; @@ -224,8 +222,7 @@ namespace pcl out->height = 1; } - typedef typename pcl::NormalEstimation NormalEstimator_; - NormalEstimator_ n3d; + pcl::NormalEstimation n3d; typename pcl::search::KdTree::Ptr normals_tree (new pcl::search::KdTree); normals_tree->setInputCloud (out); n3d.setRadiusSearch (radius); @@ -242,10 +239,10 @@ namespace pcl { pcl::ScopeTime t ("check nans..."); int j = 0; - for (size_t i = 0; i < normals->points.size (); ++i) + for (std::size_t i = 0; i < normals->points.size (); ++i) { - if (!pcl_isfinite (normals->points[i].normal_x) || !pcl_isfinite (normals->points[i].normal_y) - || !pcl_isfinite (normals->points[i].normal_z)) + if (!std::isfinite (normals->points[i].normal_x) || !std::isfinite (normals->points[i].normal_y) + || !std::isfinite (normals->points[i].normal_z)) continue; normals->points[j] = normals->points[i]; @@ -266,10 +263,10 @@ namespace pcl //is is organized, we set the xyz points to NaN pcl::ScopeTime t ("check nans organized..."); bool NaNs = false; - for (size_t i = 0; i < normals->points.size (); ++i) + for (std::size_t i = 0; i < normals->points.size (); ++i) { - if (pcl_isfinite (normals->points[i].normal_x) && pcl_isfinite (normals->points[i].normal_y) - && pcl_isfinite (normals->points[i].normal_z)) + if (std::isfinite (normals->points[i].normal_x) && std::isfinite (normals->points[i].normal_y) + && std::isfinite (normals->points[i].normal_z)) continue; NaNs = true; @@ -284,7 +281,7 @@ namespace pcl } } - /*for (size_t i = 0; i < out->points.size (); i++) + /*for (std::size_t i = 0; i < out->points.size (); i++) { int r, g, b; r = static_cast (out->points[i].r); @@ -296,5 +293,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_NORMAL_ESTIMATOR_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h index 3af9d17c..6eaa85f6 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/mesh_source.h @@ -5,17 +5,18 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_MESH_SOURCE_H_ -#define REC_FRAMEWORK_MESH_SOURCE_H_ +#pragma once #include #include #include #include #include -#include + #include +#include + namespace pcl { namespace rec_3d_framework @@ -29,8 +30,8 @@ namespace pcl template class MeshSource : public Source { - typedef Source SourceT; - typedef Model ModelT; + using SourceT = Source; + using ModelT = Model; using SourceT::path_; using SourceT::models_; @@ -43,7 +44,7 @@ namespace pcl float radius_sphere_; float view_angle_; bool gen_organized_; - boost::function campos_constraints_func_; public: @@ -63,7 +64,7 @@ namespace pcl } void - setCamPosConstraints (boost::function & bb) { campos_constraints_func_ = bb; @@ -105,21 +106,16 @@ namespace pcl //load views, poses and self-occlusions std::vector < std::string > view_filenames; int number_of_views = 0; - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (trained_dir); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(trained_dir)) { //check if its a directory, then get models in it - if (!(bf::is_directory (*itr))) + if (!(bf::is_directory (dir_entry))) { //check that it is a ply file and then add, otherwise ignore.. std::vector < std::string > strs; std::vector < std::string > strs_; -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file = (itr->path ().filename ()).string(); -#else - std::string file = (itr->path ()).filename (); -#endif + std::string file = (dir_entry.path ().filename ()).string(); boost::split (strs, file, boost::is_any_of (".")); boost::split (strs_, file, boost::is_any_of ("_")); @@ -128,31 +124,27 @@ namespace pcl if (extension == "pcd" && strs_[0] == "view") { -#if BOOST_FILESYSTEM_VERSION == 3 - view_filenames.push_back ((itr->path ().filename ()).string()); -#else - view_filenames.push_back ((itr->path ()).filename ()); -#endif + view_filenames.push_back ((dir_entry.path ().filename ()).string()); number_of_views++; } } } - for (size_t i = 0; i < view_filenames.size (); i++) + for (const auto &view_filename : view_filenames) { std::stringstream view_file; - view_file << pathmodel.str () << "/" << view_filenames[i]; + view_file << pathmodel.str () << "/" << view_filename; typename pcl::PointCloud::Ptr cloud (new pcl::PointCloud ()); pcl::io::loadPCDFile (view_file.str (), *cloud); model.views_->push_back (cloud); - std::string file_replaced1 (view_filenames[i]); + std::string file_replaced1 (view_filename); boost::replace_all (file_replaced1, "view", "pose"); boost::replace_all (file_replaced1, ".pcd", ".txt"); - std::string file_replaced2 (view_filenames[i]); + std::string file_replaced2 (view_filename); boost::replace_all (file_replaced2, "view", "entropy"); boost::replace_all (file_replaced2, ".pcd", ".txt"); @@ -218,7 +210,7 @@ namespace pcl model.poses_.reset (new std::vector > ()); model.self_occlusions_.reset (new std::vector ()); - for (size_t i = 0; i < views_xyz_orig.size (); i++) + for (std::size_t i = 0; i < views_xyz_orig.size (); i++) { model.views_->push_back (views_xyz_orig[i]); model.poses_->push_back (poses[i]); @@ -229,7 +221,7 @@ namespace pcl direc << dir << "/" << model.class_ << "/" << model.id_; this->createClassAndModelDirectories (dir, model.class_, model.id_); - for (size_t i = 0; i < model.views_->size (); i++) + for (std::size_t i = 0; i < model.views_->size (); i++) { //save generated model for future use std::stringstream path_view; @@ -255,7 +247,7 @@ namespace pcl * \brief Creates the model representation of the training set, generating views if needed */ void - generate (std::string & training_dir) + generate (std::string & training_dir) override { //create training dir fs if not existent @@ -263,25 +255,23 @@ namespace pcl //get models in directory std::vector < std::string > files; - std::string start = ""; + std::string start; std::string ext = std::string ("ply"); bf::path dir = path_; getModelsInDirectory (dir, start, files, ext); models_.reset (new std::vector); - for (size_t i = 0; i < files.size (); i++) + for (const auto &filename : files) { ModelT m; - this->getIdAndClassFromFilename (files[i], m.id_, m.class_); + this->getIdAndClassFromFilename (filename, m.id_, m.class_); //check which of them have been trained using training_dir and the model_id_ //load views, poses and self-occlusions for those that exist //generate otherwise - std::cout << files[i] << std::endl; - std::stringstream model_path; - model_path << path_ << "/" << files[i]; - std::string path_model = model_path.str (); + std::cout << filename << std::endl; + std::string path_model = path_ + '/' + filename; loadOrGenerate (training_dir, path_model, m); models_->push_back (m); @@ -290,5 +280,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_MESH_SOURCE_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h index f6759c0d..6635ebcc 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/registered_views_source.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_MESH_SOURCE_H_ -#define REC_FRAMEWORK_MESH_SOURCE_H_ +#pragma once #include #include @@ -31,8 +30,8 @@ namespace pcl template class RegisteredViewsSource : public Source { - typedef Source SourceT; - typedef Model ModelT; + using SourceT = Source; + using ModelT = Model; using SourceT::path_; using SourceT::models_; @@ -66,19 +65,14 @@ namespace pcl getViewsFilenames (bf::path & path_with_views, std::vector & view_filenames) { int number_of_views = 0; - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (path_with_views); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(path_with_views)) { - if (!(bf::is_directory (*itr))) + if (!(bf::is_directory (dir_entry))) { std::vector < std::string > strs; std::vector < std::string > strs_; -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file = (itr->path ().filename ()).string(); -#else - std::string file = (itr->path ()).filename (); -#endif + std::string file = (dir_entry.path ().filename ()).string(); boost::split (strs, file, boost::is_any_of (".")); boost::split (strs_, file, boost::is_any_of ("_")); @@ -87,11 +81,7 @@ namespace pcl if (extension == "pcd" && (strs_[0].compare (view_prefix_) == 0)) { -#if BOOST_FILESYSTEM_VERSION == 3 - view_filenames.push_back ((itr->path ().filename ()).string()); -#else - view_filenames.push_back ((itr->path ()).filename ()); -#endif + view_filenames.push_back ((dir_entry.path ().filename ()).string()); number_of_views++; } @@ -101,7 +91,7 @@ namespace pcl void assembleModelFromViewsAndPoses(ModelT & model, std::vector > & poses) { - for(size_t i=0; i < model.views_->size(); i++) { + for(std::size_t i=0; i < model.views_->size(); i++) { Eigen::Matrix4f inv = poses[i]; typename pcl::PointCloud::Ptr global_cloud(new pcl::PointCloud); pcl::transformPointCloud(*(model.views_->at(i)),*global_cloud, inv); @@ -125,8 +115,7 @@ namespace pcl //load views and poses std::vector < std::string > view_filenames; int number_of_views = 0; - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (trained_dir); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(trained_dir)) { //check if its a directory, then get models in it if (!(bf::is_directory (*itr))) @@ -135,11 +124,7 @@ namespace pcl std::vector < std::string > strs; std::vector < std::string > strs_; -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file = (itr->path ().filename ()).string(); -#else - std::string file = (itr->path ()).filename (); -#endif + std::string file = (dir_entry.path ().filename ()).string(); boost::split (strs, file, boost::is_any_of (".")); boost::split (strs_, file, boost::is_any_of ("_")); @@ -148,12 +133,7 @@ namespace pcl if (extension == "pcd" && strs_[0] == "view") { -#if BOOST_FILESYSTEM_VERSION == 3 - view_filenames.push_back ((itr->path ().filename ()).string()); -#else - view_filenames.push_back ((itr->path ()).filename ()); -#endif - + view_filenames.push_back ((dir_entry.path ().filename ()).string()); number_of_views++; } } @@ -161,7 +141,7 @@ namespace pcl std::vector > poses_to_assemble_; - for (size_t i = 0; i < view_filenames.size (); i++) + for (std::size_t i = 0; i < view_filenames.size (); i++) { std::stringstream view_file; view_file << pathmodel.str () << "/" << view_filenames[i]; @@ -232,7 +212,7 @@ namespace pcl getViewsFilenames (model_dir, view_filenames); std::cout << view_filenames.size () << std::endl; - for (size_t i = 0; i < view_filenames.size (); i++) + for (std::size_t i = 0; i < view_filenames.size (); i++) { std::stringstream view_file; view_file << model_path << "/" << view_filenames[i]; @@ -274,11 +254,10 @@ namespace pcl bool isleafDirectory (bf::path & path) { - bf::directory_iterator end_itr; bool no_dirs_inside = true; - for (bf::directory_iterator itr (path); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(path)) { - if (bf::is_directory (*itr)) + if (bf::is_directory (dir_entry)) { no_dirs_inside = false; } @@ -290,29 +269,18 @@ namespace pcl void getModelsInDirectory (bf::path & dir, std::string & rel_path_so_far, std::vector & relative_paths) { - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (dir); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(dir)) { //check if its a directory, then get models in it - if (bf::is_directory (*itr)) + if (bf::is_directory (dir_entry)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string so_far = rel_path_so_far + (itr->path ().filename ()).string() + "/"; -#else - std::string so_far = rel_path_so_far + (itr->path ()).filename () + "/"; -#endif - - bf::path curr_path = itr->path (); + std::string so_far = rel_path_so_far + (dir_entry.path ().filename ()).string() + "/"; + bf::path curr_path = dir_entry.path (); if (isleafDirectory (curr_path)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string path = rel_path_so_far + (itr->path ().filename ()).string(); -#else - std::string path = rel_path_so_far + (itr->path ()).filename (); -#endif + std::string path = rel_path_so_far + (dir_entry.path ().filename ()).string(); relative_paths.push_back (path); - } else { @@ -340,7 +308,7 @@ namespace pcl models_.reset (new std::vector); - for (size_t i = 0; i < files.size (); i++) + for (std::size_t i = 0; i < files.size (); i++) { ModelT m; @@ -384,5 +352,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_MESH_SOURCE_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h index d5706085..2b241084 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pc_source/source.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_VIEWS_SOURCE_H_ -#define REC_FRAMEWORK_VIEWS_SOURCE_H_ +#pragma once #include #include @@ -30,13 +29,13 @@ namespace pcl template class Model { - typedef typename pcl::PointCloud::Ptr PointTPtr; - typedef typename pcl::PointCloud::ConstPtr PointTPtrConst; + using PointTPtr = typename pcl::PointCloud::Ptr; + using PointTPtrConst = typename pcl::PointCloud::ConstPtr; public: - boost::shared_ptr > views_; - boost::shared_ptr > > poses_; - boost::shared_ptr > self_occlusions_; + std::shared_ptr> views_; + std::shared_ptr>> poses_; + std::shared_ptr> self_occlusions_; std::string id_; std::string class_; PointTPtr assembled_; @@ -83,15 +82,15 @@ namespace pcl { protected: - typedef Model ModelT; + using ModelT = Model; std::string path_; - boost::shared_ptr > models_; + std::shared_ptr> models_; float model_scale_; bool filter_duplicate_views_; bool load_views_; void - getIdAndClassFromFilename (std::string & filename, std::string & id, std::string & classname) + getIdAndClassFromFilename (const std::string & filename, std::string & id, std::string & classname) { std::vector < std::string > strs; @@ -126,9 +125,9 @@ namespace pcl std::stringstream ss; ss << training_dir << "/"; - for (size_t i = 0; i < strs.size (); i++) + for (const auto &str : strs) { - ss << strs[i] << "/"; + ss << str << "/"; bf::path trained_dir = ss.str (); if (!bf::exists (trained_dir)) bf::create_directory (trained_dir); @@ -146,6 +145,9 @@ namespace pcl load_views_ = true; } + virtual + ~Source() = default; + float getScale () { @@ -166,41 +168,28 @@ namespace pcl void getModelsInDirectory (bf::path & dir, std::string & rel_path_so_far, std::vector & relative_paths, std::string & ext) { - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (dir); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(dir)) { //check if its a directory, then get models in it - if (bf::is_directory (*itr)) + if (bf::is_directory (dir_entry)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string so_far = rel_path_so_far + (itr->path ().filename ()).string() + "/"; -#else - std::string so_far = rel_path_so_far + (itr->path ()).filename () + "/"; -#endif + std::string so_far = rel_path_so_far + (dir_entry.path ().filename ()).string() + "/"; - bf::path curr_path = itr->path (); + bf::path curr_path = dir_entry.path (); getModelsInDirectory (curr_path, so_far, relative_paths, ext); } else { //check that it is a ply file and then add, otherwise ignore.. std::vector < std::string > strs; -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file = (itr->path ().filename ()).string(); -#else - std::string file = (itr->path ()).filename (); -#endif + std::string file = (dir_entry.path ().filename ()).string(); boost::split (strs, file, boost::is_any_of (".")); std::string extension = strs[strs.size () - 1]; - if (extension.compare (ext) == 0) + if (extension == ext) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string path = rel_path_so_far + (itr->path ().filename ()).string(); -#else - std::string path = rel_path_so_far + (itr->path ()).filename (); -#endif + std::string path = rel_path_so_far + (dir_entry.path ().filename ()).string(); relative_paths.push_back (path); } @@ -211,7 +200,7 @@ namespace pcl void voxelizeAllModels (float resolution) { - for (size_t i = 0; i < models_->size (); i++) + for (std::size_t i = 0; i < models_->size (); i++) { models_->at (i).getAssembled (resolution); } @@ -226,20 +215,20 @@ namespace pcl /** * \brief Get the generated model */ - boost::shared_ptr > + std::shared_ptr> getModels () { return models_; } - boost::shared_ptr > + std::shared_ptr> getModels (std::string & model_id) { typename std::vector::iterator it = models_->begin (); while (it != models_->end ()) { - if (model_id.compare ((*it).id_) != 0) + if (model_id != (*it).id_) { it = models_->erase (it); } @@ -259,12 +248,7 @@ namespace pcl dir << base_dir << "/" << m.class_ << "/" << m.id_ << "/" << descr_name; bf::path desc_dir = dir.str (); std::cout << dir.str () << std::endl; - if (bf::exists (desc_dir)) - { - return true; - } - - return false; + return bf::exists (desc_dir); } std::string @@ -297,5 +281,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_VIEWS_SOURCE_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h index 5a78c51d..f8cad7e0 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_classifier.h @@ -5,10 +5,10 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_GLOBAL_PIPELINE_H_ -#define REC_FRAMEWORK_GLOBAL_PIPELINE_H_ +#pragma once + +#include -#include #include #include #include @@ -21,7 +21,7 @@ namespace pcl template class PCL_EXPORTS GlobalClassifier { public: - typedef typename pcl::PointCloud::Ptr PointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; virtual void setNN (int nn) = 0; @@ -73,9 +73,9 @@ namespace pcl } } sortIndexScoresOp; - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef Distance DistT; - typedef Model ModelT; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using DistT = Distance; + using ModelT = Model; /** \brief Directory where the trained structure will be saved */ std::string training_dir_; @@ -84,15 +84,15 @@ namespace pcl PointInTPtr input_; /** \brief Model data source */ - typename boost::shared_ptr > source_; + std::shared_ptr> source_; /** \brief Computes a feature */ - typename boost::shared_ptr > estimator_; + std::shared_ptr> estimator_; /** \brief Descriptor name */ std::string descr_name_; - typedef std::pair > flann_model; + using flann_model = std::pair >; flann::Matrix flann_data_; flann::Index * flann_index_; std::vector flann_models_; @@ -111,8 +111,8 @@ namespace pcl flann::Matrix flann_data (new float[models.size () * models[0].second.size ()], models.size (), models[0].second.size ()); - for (size_t i = 0; i < data.rows; ++i) - for (size_t j = 0; j < data.cols; ++j) + for (std::size_t i = 0; i < data.rows; ++i) + for (std::size_t j = 0; j < data.cols; ++j) { flann_data.ptr ()[i * data.cols + j] = models[i].second[j]; } @@ -141,19 +141,19 @@ namespace pcl } void - setNN (int nn) + setNN (int nn) override { NN_ = nn; } void - getCategory (std::vector & categories) + getCategory (std::vector & categories) override { categories = categories_; } void - getConfidence (std::vector & conf) + getConfidence (std::vector & conf) override { conf = confidences_; } @@ -170,13 +170,13 @@ namespace pcl */ void - classify (); + classify () override; /** * \brief Sets the model data source_ */ void - setDataSource (typename boost::shared_ptr > & source) + setDataSource (std::shared_ptr>& source) { source_ = source; } @@ -186,13 +186,13 @@ namespace pcl */ void - setFeatureEstimator (typename boost::shared_ptr > & feat) + setFeatureEstimator (std::shared_ptr>& feat) { estimator_ = feat; } void - setIndices (std::vector & indices) + setIndices (std::vector & indices) override { indices_ = indices; } @@ -201,7 +201,7 @@ namespace pcl * \brief Sets the input cloud to be classified */ void - setInputCloud (const PointInTPtr & cloud) + setInputCloud (const PointInTPtr & cloud) override { input_ = cloud; } @@ -220,4 +220,3 @@ namespace pcl }; } } -#endif /* REC_FRAMEWORK_GLOBAL_PIPELINE_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h index 80d116dd..ae4df372 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_GLOBAL_RECOGNIZER_CRH_H_ -#define REC_FRAMEWORK_GLOBAL_RECOGNIZER_CRH_H_ +#pragma once #include #include @@ -50,12 +49,12 @@ namespace pcl } } sortIndexScoresOp; - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::ConstPtr ConstPointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using ConstPointInTPtr = typename pcl::PointCloud::ConstPtr; - typedef Distance DistT; - typedef Model ModelT; - typedef pcl::PointCloud > CRHPointCloud; + using DistT = Distance; + using ModelT = Model; + using CRHPointCloud = pcl::PointCloud >; /** \brief Directory where the trained structure will be saved */ std::string training_dir_; @@ -64,13 +63,13 @@ namespace pcl PointInTPtr input_; /** \brief Model data source */ - typename boost::shared_ptr > source_; + std::shared_ptr> source_; /** \brief Computes a feature */ - typename boost::shared_ptr > crh_estimator_; + std::shared_ptr> crh_estimator_; /** \brief Hypotheses verification algorithm */ - typename boost::shared_ptr > hv_algorithm_; + std::shared_ptr> hv_algorithm_; /** \brief Descriptor name */ std::string descr_name_; @@ -96,7 +95,7 @@ namespace pcl bool use_cache_; std::map, Eigen::Matrix4f, - std::less >, + std::less<>, Eigen::aligned_allocator, Eigen::Matrix4f> > > poses_cache_; std::map, Eigen::Vector3f > centroids_cache_; @@ -114,8 +113,8 @@ namespace pcl flann::Matrix flann_data (new float[models.size () * models[0].descr.size ()], models.size (), models[0].descr.size ()); - for (size_t i = 0; i < data.rows; ++i) - for (size_t j = 0; j < data.cols; ++j) + for (std::size_t i = 0; i < data.rows; ++i) + for (std::size_t j = 0; j < data.cols; ++j) { flann_data.ptr ()[i * data.cols + j] = models[i].descr[j]; } @@ -140,8 +139,8 @@ namespace pcl int NN_; - boost::shared_ptr > models_; - boost::shared_ptr > > transforms_; + std::shared_ptr> models_; + std::shared_ptr>> transforms_; public: @@ -188,7 +187,7 @@ namespace pcl * \brief Sets the model data source_ */ void - setDataSource (typename boost::shared_ptr > & source) + setDataSource (std::shared_ptr>& source) { source_ = source; } @@ -198,7 +197,7 @@ namespace pcl */ void - setFeatureEstimator (typename boost::shared_ptr > & feat) + setFeatureEstimator (std::shared_ptr>& feat) { crh_estimator_ = feat; } @@ -207,7 +206,7 @@ namespace pcl * \brief Sets the HV algorithm */ void - setHVAlgorithm (typename boost::shared_ptr > & alg) + setHVAlgorithm (std::shared_ptr>& alg) { hv_algorithm_ = alg; } @@ -246,13 +245,13 @@ namespace pcl void recognize (); - boost::shared_ptr > + std::shared_ptr> getModels () { return models_; } - boost::shared_ptr > > + std::shared_ptr>> getTransforms () { return transforms_; @@ -269,4 +268,3 @@ namespace pcl }; } } -#endif /* REC_FRAMEWORK_GLOBAL_PIPELINE_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h index ddf26ad2..e883d255 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h @@ -5,10 +5,10 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_GLOBAL_RECOGNIZER_CVFH_H_ -#define REC_FRAMEWORK_GLOBAL_RECOGNIZER_CVFH_H_ +#pragma once + +#include -#include #include #include #include @@ -48,11 +48,11 @@ namespace pcl } } sortIndexScoresOp; - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::ConstPtr ConstPointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using ConstPointInTPtr = typename pcl::PointCloud::ConstPtr; - typedef Distance DistT; - typedef Model ModelT; + using DistT = Distance; + using ModelT = Model; /** \brief Directory where the trained structure will be saved */ std::string training_dir_; @@ -61,13 +61,13 @@ namespace pcl PointInTPtr input_; /** \brief Model data source */ - typename boost::shared_ptr > source_; + std::shared_ptr> source_; /** \brief Computes a feature */ - typename boost::shared_ptr > micvfh_estimator_; + std::shared_ptr> micvfh_estimator_; /** \brief Hypotheses verification algorithm */ - typename boost::shared_ptr > hv_algorithm_; + std::shared_ptr> hv_algorithm_; /** \brief Descriptor name */ std::string descr_name_; @@ -92,26 +92,20 @@ namespace pcl { return true; } - else - { - if (this->model.id_.compare (other.model.id_) == 0) + if (this->model.id_ == other.model.id_) + { + //check view id + if ((this->view_id < other.view_id)) { - //check view id - if ((this->view_id < other.view_id)) + return true; + } + if (this->view_id == other.view_id) + { + if (this->descriptor_id < other.descriptor_id) { return true; } - else - { - if (this->view_id == other.view_id) - { - if (this->descriptor_id < other.descriptor_id) - { - return true; - } - } - } } } @@ -132,14 +126,14 @@ namespace pcl std::vector > single_categories_data_; std::vector *> single_categories_index_; - std::vector > > single_categories_pointers_to_models_; + std::vector>> single_categories_pointers_to_models_; std::map category_to_vectors_indices_; std::vector categories_to_be_searched_; bool use_single_categories_; bool use_cache_; std::map, Eigen::Matrix4f, - std::less >, + std::less<>, Eigen::aligned_allocator, Eigen::Matrix4f> > > poses_cache_; std::map, Eigen::Vector3f> centroids_cache_; @@ -159,8 +153,8 @@ namespace pcl flann::Matrix flann_data (new float[models.size () * models[0].descr.size ()], models.size (), models[0].descr.size ()); - for (size_t i = 0; i < data.rows; ++i) - for (size_t j = 0; j < data.cols; ++j) + for (std::size_t i = 0; i < data.rows; ++i) + for (std::size_t j = 0; j < data.cols; ++j) { flann_data.ptr ()[i * data.cols + j] = models[i].descr[j]; } @@ -169,15 +163,15 @@ namespace pcl } inline void - convertToFLANN (const std::vector &models, boost::shared_ptr > & indices, flann::Matrix &data) + convertToFLANN (const std::vector &models, const std::shared_ptr>& indices, flann::Matrix &data) { data.rows = indices->size (); data.cols = models[0].descr.size (); // number of histogram bins flann::Matrix flann_data(new float[indices->size () * models[0].descr.size ()],indices->size(),models[0].descr.size ()); - for (size_t i = 0; i < data.rows; ++i) - for (size_t j = 0; j < data.cols; ++j) + for (std::size_t i = 0; i < data.rows; ++i) + for (std::size_t j = 0; j < data.cols; ++j) { flann_data.ptr()[i * data.cols + j] = models[indices->at(i)].descr[j]; } @@ -202,8 +196,8 @@ namespace pcl int NN_; - boost::shared_ptr > models_; - boost::shared_ptr > > transforms_; + std::shared_ptr> models_; + std::shared_ptr>> transforms_; std::vector descriptor_distances_; @@ -274,7 +268,7 @@ namespace pcl * \brief Sets the model data source_ */ void - setDataSource (typename boost::shared_ptr > & source) + setDataSource (std::shared_ptr>& source) { source_ = source; } @@ -284,7 +278,7 @@ namespace pcl */ void - setFeatureEstimator (typename boost::shared_ptr > & feat) + setFeatureEstimator (std::shared_ptr>& feat) { micvfh_estimator_ = feat; } @@ -293,7 +287,7 @@ namespace pcl * \brief Sets the HV algorithm */ void - setHVAlgorithm (typename boost::shared_ptr > & alg) + setHVAlgorithm (std::shared_ptr>& alg) { hv_algorithm_ = alg; } @@ -332,13 +326,13 @@ namespace pcl void recognize (); - boost::shared_ptr > + std::shared_ptr> getModels () { return models_; } - boost::shared_ptr > > + std::shared_ptr>> getTransforms () { return transforms_; @@ -353,4 +347,3 @@ namespace pcl }; } } -#endif /* REC_FRAMEWORK_GLOBAL_PIPELINE_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp index a9f299df..ba45fdec 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_classifier.hpp @@ -11,27 +11,21 @@ template class Distance, typename PointInT, typename FeatureT> void pcl::rec_3d_framework::GlobalNNPipeline::loadFeaturesAndCreateFLANN () { - boost::shared_ptr < std::vector > models = source_->getModels (); - for (size_t i = 0; i < models->size (); i++) + auto models = source_->getModels (); + for (std::size_t i = 0; i < models->size (); i++) { std::string path = source_->getModelDescriptorDir (models->at (i), training_dir_, descr_name_); - bf::path inside = path; - bf::directory_iterator end_itr; - for (bf::directory_iterator itr_in (inside); itr_in != end_itr; ++itr_in) + for (const auto& dir_entry : bf::directory_iterator(path)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file_name = (itr_in->path ().filename ()).string(); -#else - std::string file_name = (itr_in->path ()).filename (); -#endif + std::string file_name = (dir_entry.path ().filename ()).string(); std::vector < std::string > strs; boost::split (strs, file_name, boost::is_any_of ("_")); if (strs[0] == "descriptor") { - std::string full_file_name = itr_in->path ().string (); + std::string full_file_name = dir_entry.path ().string (); std::vector < std::string > strs; boost::split (strs, full_file_name, boost::is_any_of ("/")); @@ -85,7 +79,7 @@ template class Distance, typename PointInT, typename FeatureT> typename pcl::PointCloud::CloudVectorType signatures; std::vector < Eigen::Vector3f, Eigen::aligned_allocator > centroids; - if (indices_.size ()) + if (!indices_.empty ()) { pcl::copyPointCloud (*input_, indices_, *in); } @@ -97,9 +91,9 @@ template class Distance, typename PointInT, typename FeatureT> estimator_->estimate (in, processed, signatures, centroids); std::vector indices_scores; - if (signatures.size () > 0) + if (!signatures.empty ()) { - for (size_t idx = 0; idx < signatures.size (); idx++) + for (std::size_t idx = 0; idx < signatures.size (); idx++) { float* hist = signatures[idx].points[0].histogram; int size_feat = sizeof(signatures[idx].points[0].histogram) / sizeof(float); @@ -128,13 +122,12 @@ template class Distance, typename PointInT, typename FeatureT> first_nn_category_ = flann_models_[indices_scores[0].idx_models_].first.class_; std::map category_map; - std::map::iterator it; int num_n = std::min (NN_, static_cast (indices_scores.size ())); for (int i = 0; i < num_n; ++i) { std::string cat = flann_models_[indices_scores[i].idx_models_].first.class_; - it = category_map.find (cat); + auto it = category_map.find (cat); if (it == category_map.end ()) { category_map[cat] = 1; @@ -145,10 +138,10 @@ template class Distance, typename PointInT, typename FeatureT> } } - for (it = category_map.begin (); it != category_map.end (); it++) + for (const auto &category : category_map) { - float prob = static_cast (it->second) / static_cast (num_n); - categories_.push_back (it->first); + float prob = static_cast (category.second) / static_cast (num_n); + categories_.push_back (category.first); confidences_.push_back (prob); } @@ -167,22 +160,22 @@ template class Distance, typename PointInT, typename FeatureT> //use the source to know what has to be trained and what not, checking if the descr_name directory exists //unless force_retrain is true, then train everything - boost::shared_ptr < std::vector > models = source_->getModels (); + auto models = source_->getModels (); std::cout << "Models size:" << models->size () << std::endl; if (force_retrain) { - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { source_->removeDescDirectory (models->at (i), training_dir_, descr_name_); } } - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { if (!source_->modelAlreadyTrained (models->at (i), training_dir_, descr_name_)) { - for (size_t v = 0; v < models->at (i).views_->size (); v++) + for (std::size_t v = 0; v < models->at (i).views_->size (); v++) { PointInTPtr processed (new pcl::PointCloud); //pro view, compute signatures @@ -210,7 +203,7 @@ template class Distance, typename PointInT, typename FeatureT> PersistenceUtils::writeFloatToFile (path_entropy.str (), models->at (i).self_occlusions_->at (v)); //save signatures and centroids to disk - for (size_t j = 0; j < signatures.size (); j++) + for (std::size_t j = 0; j < signatures.size (); j++) { std::stringstream path_centroid; path_centroid << path << "/centroid_" << v << "_" << j << ".txt"; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp index d296e985..867e2031 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_crh.hpp @@ -5,11 +5,11 @@ * Author: aitor */ +#include + #include #include #include -#include -#include #include template class Distance, typename PointInT, typename FeatureT> @@ -19,11 +19,11 @@ template class Distance, typename PointInT, typename FeatureT> if (use_cache_) { - typedef std::pair mv_pair; + using mv_pair = std::pair; mv_pair pair_model_view = std::make_pair (model.id_, view_id); std::map, + std::less<>, Eigen::aligned_allocator > >::iterator it = poses_cache_.find (pair_model_view); if (it != poses_cache_.end ()) @@ -83,20 +83,14 @@ template class Distance, typename PointInT, typename FeatureT> void pcl::rec_3d_framework::GlobalNNCRHRecognizer::loadFeaturesAndCreateFLANN () { - boost::shared_ptr < std::vector > models = source_->getModels (); - for (size_t i = 0; i < models->size (); i++) + auto models = source_->getModels (); + for (std::size_t i = 0; i < models->size (); i++) { std::string path = source_->getModelDescriptorDir (models->at (i), training_dir_, descr_name_); - bf::path inside = path; - bf::directory_iterator end_itr; - for (bf::directory_iterator itr_in (inside); itr_in != end_itr; ++itr_in) + for (const auto& dir_entry : bf::directory_iterator(path)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file_name = (itr_in->path ().filename ()).string(); -#else - std::string file_name = (itr_in->path ()).filename (); -#endif + std::string file_name = (dir_entry.path ().filename ()).string(); std::vector < std::string > strs; boost::split (strs, file_name, boost::is_any_of ("_")); @@ -109,7 +103,7 @@ template class Distance, typename PointInT, typename FeatureT> boost::split (strs1, strs[2], boost::is_any_of (".")); int descriptor_id = atoi (strs1[0].c_str ()); - std::string full_file_name = itr_in->path ().string (); + std::string full_file_name = dir_entry.path ().string (); typename pcl::PointCloud::Ptr signature (new pcl::PointCloud); pcl::io::loadPCDFile (full_file_name, *signature); @@ -174,7 +168,7 @@ template class Distance, typename PointInT, typename FeatureT> std::vector, Eigen::aligned_allocator > > signatures; std::vector < Eigen::Vector3f, Eigen::aligned_allocator > centroids; - if (indices_.size ()) + if (!indices_.empty ()) pcl::copyPointCloud (*input_, indices_, *in); else in = input_; @@ -188,12 +182,12 @@ template class Distance, typename PointInT, typename FeatureT> crh_estimator_->getCRHHistograms (crh_histograms); std::vector indices_scores; - if (signatures.size () > 0) + if (!signatures.empty ()) { { pcl::ScopeTime t_matching ("Matching and roll..."); - for (size_t idx = 0; idx < signatures.size (); idx++) + for (std::size_t idx = 0; idx < signatures.size (); idx++) { float* hist = signatures[idx].points[0].histogram; @@ -291,9 +285,9 @@ template class Distance, typename PointInT, typename FeatureT> crha.getTransforms (roll_transforms); //create object hypothesis - for (size_t k = 0; k < roll_transforms.size (); k++) + for (const auto &roll_transform : roll_transforms) { - Eigen::Matrix4f final_roll_trans (roll_transforms[k] * model_view_pose); + Eigen::Matrix4f final_roll_trans (roll_transform * model_view_pose); models_->push_back (m); transforms_->push_back (final_roll_trans); } @@ -363,7 +357,7 @@ template class Distance, typename PointInT, typename FeatureT> std::vector::ConstPtr> aligned_models; aligned_models.resize (models_->size ()); - for (size_t i = 0; i < models_->size (); i++) + for (std::size_t i = 0; i < models_->size (); i++) { ConstPointInTPtr model_cloud = models_->at (i).getAssembled (0.005f); PointInTPtr model_aligned (new pcl::PointCloud); @@ -377,13 +371,13 @@ template class Distance, typename PointInT, typename FeatureT> hv_algorithm_->verify (); hv_algorithm_->getMask (mask_hv); - boost::shared_ptr < std::vector > models_temp; - boost::shared_ptr < std::vector > > transforms_temp; + std::shared_ptr> models_temp; + std::shared_ptr>> transforms_temp; models_temp.reset (new std::vector); transforms_temp.reset (new std::vector >); - for (size_t i = 0; i < models_->size (); i++) + for (std::size_t i = 0; i < models_->size (); i++) { if (!mask_hv[i]) continue; @@ -406,39 +400,34 @@ template class Distance, typename PointInT, typename FeatureT> //use the source to know what has to be trained and what not, checking if the descr_name directory exists //unless force_retrain is true, then train everything - boost::shared_ptr < std::vector > models = source_->getModels (); + auto models = source_->getModels (); std::cout << "Models size:" << models->size () << std::endl; if (force_retrain) { - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { source_->removeDescDirectory (models->at (i), training_dir_, descr_name_); } } - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { if (!source_->modelAlreadyTrained (models->at (i), training_dir_, descr_name_)) { - for (size_t v = 0; v < models->at (i).views_->size (); v++) + for (std::size_t v = 0; v < models->at (i).views_->size (); v++) { PointInTPtr processed (new pcl::PointCloud); PointInTPtr view = models->at (i).views_->at (v); if (noisify_) { - double noise_std = noise_; - boost::posix_time::ptime time = boost::posix_time::microsec_clock::local_time(); - boost::posix_time::time_duration duration( time.time_of_day() ); - boost::mt19937 rng; - rng.seed (static_cast (duration.total_milliseconds())); - boost::normal_distribution<> nd (0.0, noise_std); - boost::variate_generator > var_nor (rng, nd); + std::random_device rd; + std::mt19937 rng(rd()); + std::normal_distribution nd (0.0f, noise_); // Noisify each point in the dataset - for (size_t cp = 0; cp < view->points.size (); ++cp) - view->points[cp].z += static_cast (var_nor ()); - + for (std::size_t cp = 0; cp < view->points.size (); ++cp) + view->points[cp].z += nd (rng); } //pro view, compute signatures and CRH @@ -468,7 +457,7 @@ template class Distance, typename PointInT, typename FeatureT> crh_estimator_->getCRHHistograms (crh_histograms); //save signatures and centroids to disk - for (size_t j = 0; j < signatures.size (); j++) + for (std::size_t j = 0; j < signatures.size (); j++) { std::stringstream path_centroid; path_centroid << path << "/centroid_" << v << "_" << j << ".txt"; diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp index f0d93b46..aa000b70 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/global_nn_recognizer_cvfh.hpp @@ -5,10 +5,9 @@ * Author: aitor */ +#include #include #include -#include -#include #include #include @@ -19,11 +18,11 @@ template class Distance, typename PointInT, typename FeatureT> if (use_cache_) { - typedef std::pair mv_pair; + using mv_pair = std::pair; mv_pair pair_model_view = std::make_pair (model.id_, view_id); std::map, + std::less<>, Eigen::aligned_allocator > >::iterator it = poses_cache_.find (pair_model_view); if (it != poses_cache_.end ()) @@ -58,10 +57,7 @@ template class Distance, typename PointInT, typename FeatureT> PersistenceUtils::readMatrixFromFile (dir.str (), pose_matrix); return true; } - else - { - return false; - } + return false; } template class Distance, typename PointInT, typename FeatureT> @@ -93,37 +89,31 @@ template class Distance, typename PointInT, typename FeatureT> pcl::rec_3d_framework::GlobalNNCVFHRecognizer::loadFeaturesAndCreateFLANN () { - boost::shared_ptr < std::vector > models = source_->getModels (); + auto models = source_->getModels (); - std::map < std::string, boost::shared_ptr > > single_categories; + std::map>> single_categories; if (use_single_categories_) { - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { - std::map > >::iterator it; + std::map>>::iterator it; std::string cat_model = models->at (i).class_; it = single_categories.find (cat_model); if (it == single_categories.end ()) { - boost::shared_ptr < std::vector > v (new std::vector); + std::shared_ptr> v (new std::vector); single_categories[cat_model] = v; } } } - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { std::string path = source_->getModelDescriptorDir (models->at (i), training_dir_, descr_name_); - bf::path inside = path; - bf::directory_iterator end_itr; - for (bf::directory_iterator itr_in (inside); itr_in != end_itr; ++itr_in) + for (const auto& dir_entry : bf::directory_iterator(path)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file_name = (itr_in->path ().filename ()).string(); -#else - std::string file_name = (itr_in->path ()).filename (); -#endif + std::string file_name = (dir_entry.path ().filename ()).string(); std::vector < std::string > strs; boost::split (strs, file_name, boost::is_any_of ("_")); @@ -136,7 +126,7 @@ template class Distance, typename PointInT, typename FeatureT> boost::split (strs1, strs[2], boost::is_any_of (".")); int descriptor_id = atoi (strs1[0].c_str ()); - std::string full_file_name = itr_in->path ().string (); + std::string full_file_name = dir_entry.path ().string (); typename pcl::PointCloud::Ptr signature (new pcl::PointCloud); pcl::io::loadPCDFile (full_file_name, *signature); @@ -151,7 +141,7 @@ template class Distance, typename PointInT, typename FeatureT> if (use_single_categories_) { - std::map > >::iterator it; + std::map>>::iterator it; std::string cat_model = models->at (i).class_; it = single_categories.find (cat_model); if (it == single_categories.end ()) @@ -190,21 +180,19 @@ template class Distance, typename PointInT, typename FeatureT> //single categories... if (use_single_categories_) { - std::map > >::iterator it; - single_categories_data_.resize (single_categories.size ()); single_categories_index_.resize (single_categories.size ()); single_categories_pointers_to_models_.resize (single_categories.size ()); int kk = 0; - for (it = single_categories.begin (); it != single_categories.end (); it++) + for (const auto &single_category : single_categories) { //create index and flann data - convertToFLANN (flann_models_, it->second, single_categories_data_[kk]); + convertToFLANN (flann_models_, single_category.second, single_categories_data_[kk]); single_categories_index_[kk] = new flann::Index (single_categories_data_[kk], flann::LinearIndexParams ()); - single_categories_pointers_to_models_[kk] = it->second; + single_categories_pointers_to_models_[kk] = single_category.second; - category_to_vectors_indices_[it->first] = kk; + category_to_vectors_indices_[single_category.first] = kk; kk++; } } @@ -239,7 +227,7 @@ template class Distance, typename PointInT, typename FeatureT> std::vector, Eigen::aligned_allocator > > signatures; std::vector < Eigen::Vector3f, Eigen::aligned_allocator > centroids; - if (indices_.size ()) + if (!indices_.empty ()) pcl::copyPointCloud (*input_, indices_, *in); else in = input_; @@ -252,20 +240,20 @@ template class Distance, typename PointInT, typename FeatureT> std::vector indices_scores; descriptor_distances_.clear (); - if (signatures.size () > 0) + if (!signatures.empty ()) { { pcl::ScopeTime t_matching ("Matching and roll..."); - if (use_single_categories_ && (categories_to_be_searched_.size () > 0)) + if (use_single_categories_ && (!categories_to_be_searched_.empty ())) { //perform search of the different signatures in the categories_to_be_searched_ - for (size_t c = 0; c < categories_to_be_searched_.size (); c++) + for (std::size_t c = 0; c < categories_to_be_searched_.size (); c++) { std::cout << "Using category:" << categories_to_be_searched_[c] << std::endl; - for (size_t idx = 0; idx < signatures.size (); idx++) + for (std::size_t idx = 0; idx < signatures.size (); idx++) { /*float* hist = signatures[idx].points[0].histogram; std::vector std_hist (hist, hist + getHistogramLength (dummy)); @@ -296,7 +284,7 @@ template class Distance, typename PointInT, typename FeatureT> nearestKSearch (single_categories_index_[it->second], histogram, NN_, indices, distances); //gather NN-search results double score = 0; - for (size_t i = 0; i < (size_t) NN_; ++i) + for (std::size_t i = 0; i < (std::size_t) NN_; ++i) { score = distances[0][i]; index_score is; @@ -314,7 +302,7 @@ template class Distance, typename PointInT, typename FeatureT> } else { - for (size_t idx = 0; idx < signatures.size (); idx++) + for (std::size_t idx = 0; idx < signatures.size (); idx++) { float* hist = signatures[idx].points[0].histogram; @@ -354,7 +342,7 @@ template class Distance, typename PointInT, typename FeatureT> typename std::map found; typename std::map::iterator it_map; - for (size_t i = 0; i < indices_scores.size (); i++) + for (std::size_t i = 0; i < indices_scores.size (); i++) { flann_model m = flann_models_[indices_scores[i].idx_models_]; it_map = found.find (m); @@ -568,7 +556,7 @@ template class Distance, typename PointInT, typename FeatureT> std::vector::ConstPtr> aligned_models; aligned_models.resize (models_->size ()); - for (size_t i = 0; i < models_->size (); i++) + for (std::size_t i = 0; i < models_->size (); i++) { ConstPointInTPtr model_cloud; PointInTPtr model_aligned (new pcl::PointCloud); @@ -601,13 +589,13 @@ template class Distance, typename PointInT, typename FeatureT> hv_algorithm_->verify (); hv_algorithm_->getMask (mask_hv); - boost::shared_ptr < std::vector > models_temp; - boost::shared_ptr < std::vector > > transforms_temp; + std::shared_ptr> models_temp; + std::shared_ptr>> transforms_temp; models_temp.reset (new std::vector); transforms_temp.reset (new std::vector >); - for (size_t i = 0; i < models_->size (); i++) + for (std::size_t i = 0; i < models_->size (); i++) { if (!mask_hv[i]) continue; @@ -630,42 +618,37 @@ template class Distance, typename PointInT, typename FeatureT> //use the source to know what has to be trained and what not, checking if the descr_name directory exists //unless force_retrain is true, then train everything - boost::shared_ptr < std::vector > models = source_->getModels (); + auto models = source_->getModels (); std::cout << "Models size:" << models->size () << std::endl; if (force_retrain) { - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { source_->removeDescDirectory (models->at (i), training_dir_, descr_name_); } } - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { if (!source_->modelAlreadyTrained (models->at (i), training_dir_, descr_name_)) { - for (size_t v = 0; v < models->at (i).views_->size (); v++) + for (std::size_t v = 0; v < models->at (i).views_->size (); v++) { PointInTPtr processed (new pcl::PointCloud); PointInTPtr view = models->at (i).views_->at (v); - if (view->points.size () == 0) + if (view->points.empty ()) PCL_WARN("View has no points!!!\n"); if (noisify_) { - double noise_std = noise_; - boost::posix_time::ptime time = boost::posix_time::microsec_clock::local_time(); - boost::posix_time::time_duration duration( time.time_of_day() ); - boost::mt19937 rng; - rng.seed (static_cast (duration.total_milliseconds())); - boost::normal_distribution<> nd (0.0, noise_std); - boost::variate_generator > var_nor (rng, nd); + std::random_device rd; + std::mt19937 rng(rd()); + std::normal_distribution nd (0.0f, noise_); // Noisify each point in the dataset - for (size_t cp = 0; cp < view->points.size (); ++cp) - view->points[cp].z += static_cast (var_nor ()); - + for (std::size_t cp = 0; cp < view->points.size (); ++cp) + view->points[cp].z += nd (rng); } //pro view, compute signatures @@ -698,7 +681,7 @@ template class Distance, typename PointInT, typename FeatureT> PersistenceUtils::writeFloatToFile (path_entropy.str (), models->at (i).self_occlusions_->at (v)); //save signatures and centroids to disk - for (size_t j = 0; j < signatures.size (); j++) + for (std::size_t j = 0; j < signatures.size (); j++) { if (valid_trans[j]) { diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp index 3ccc4a6f..77452f6e 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/impl/local_recognizer.hpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -10,29 +12,23 @@ template class Distance, typename PointInT, typename FeatureT> void pcl::rec_3d_framework::LocalRecognitionPipeline::loadFeaturesAndCreateFLANN () { - boost::shared_ptr < std::vector > models = source_->getModels (); + auto models = source_->getModels (); std::cout << "Models size:" << models->size () << std::endl; - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { std::string path = source_->getModelDescriptorDir (models->at (i), training_dir_, descr_name_); - bf::path inside = path; - bf::directory_iterator end_itr; - for (bf::directory_iterator itr_in (inside); itr_in != end_itr; ++itr_in) + for (const auto& dir_entry : bf::directory_iterator(path)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file_name = (itr_in->path ().filename ()).string(); -#else - std::string file_name = (itr_in->path ()).filename (); -#endif + std::string file_name = (dir_entry.path ().filename ()).string(); std::vector < std::string > strs; boost::split (strs, file_name, boost::is_any_of ("_")); if (strs[0] == "descriptor") { - std::string full_file_name = itr_in->path ().string (); + std::string full_file_name = dir_entry.path ().string (); std::string name = file_name.substr (0, file_name.length () - 4); std::vector < std::string > strs; boost::split (strs, name, boost::is_any_of ("_")); @@ -68,7 +64,7 @@ template class Distance, typename PointInT, typename FeatureT> int size_feat = sizeof(signature->points[0].histogram) / sizeof(float); - for (size_t dd = 0; dd < signature->points.size (); dd++) + for (std::size_t dd = 0; dd < signature->points.size (); dd++) { descr_model.keypoint_id = static_cast (dd); descr_model.descr.resize (size_feat); @@ -107,14 +103,14 @@ template class Distance, typename PointInT, typename FeatureT> void pcl::rec_3d_framework::LocalRecognitionPipeline::initialize (bool force_retrain) { - boost::shared_ptr < std::vector > models; + std::shared_ptr> models; - if(search_model_.compare("") == 0) { + if(search_model_.empty()) { models = source_->getModels (); } else { models = source_->getModels (search_model_); //reset cache and flann structures - if(flann_index_ != 0) + if(flann_index_ != nullptr) delete flann_index_; flann_models_.clear(); @@ -126,19 +122,19 @@ template class Distance, typename PointInT, typename FeatureT> if (force_retrain) { - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { source_->removeDescDirectory (models->at (i), training_dir_, descr_name_); } } - for (size_t i = 0; i < models->size (); i++) + for (std::size_t i = 0; i < models->size (); i++) { std::cout << models->at (i).class_ << " " << models->at (i).id_ << std::endl; if (!source_->modelAlreadyTrained (models->at (i), training_dir_, descr_name_)) { - for (size_t v = 0; v < models->at (i).views_->size (); v++) + for (std::size_t v = 0; v < models->at (i).views_->size (); v++) { PointInTPtr processed (new pcl::PointCloud); typename pcl::PointCloud::Ptr signatures (new pcl::PointCloud ()); @@ -172,9 +168,9 @@ template class Distance, typename PointInT, typename FeatureT> std::stringstream keypoints_sstr; keypoints_sstr << path << "/keypoint_indices_" << v << ".pcd"; - /*boost::shared_ptr < std::vector > indices (new std::vector ()); + /*std::shared_ptr> indices (new std::vector ()); indices->resize (keypoints.points.size ()); - for (size_t kk = 0; kk < indices->size (); kk++) + for (std::size_t kk = 0; kk < indices->size (); kk++) (*indices)[kk] = keypoints.points[kk]; typename pcl::PointCloud keypoints_pointcloud; pcl::copyPointCloud (*processed, *indices, keypoints_pointcloud);*/ @@ -208,7 +204,7 @@ template class Distance, typename PointInT, typename FeatureT> //pcl::PointCloud keypoints_input; PointInTPtr keypoints_pointcloud; - if (signatures_ != 0 && processed_ != 0 && (signatures_->size () == keypoints_pointcloud->points.size ())) + if (signatures_ != nullptr && processed_ != nullptr && (signatures_->size () == keypoints_pointcloud->points.size ())) { keypoints_pointcloud = keypoints_input_; signatures = signatures_; @@ -218,7 +214,7 @@ template class Distance, typename PointInT, typename FeatureT> else { processed.reset( (new pcl::PointCloud)); - if (indices_.size () > 0) + if (!indices_.empty ()) { PointInTPtr sub_input (new pcl::PointCloud); pcl::copyPointCloud (*input_, indices_, *sub_input); @@ -240,7 +236,7 @@ template class Distance, typename PointInT, typename FeatureT> //feature matching and object hypotheses std::map object_hypotheses; { - for (size_t idx = 0; idx < signatures->points.size (); idx++) + for (std::size_t idx = 0; idx < signatures->points.size (); idx++) { float* hist = signatures->points[idx].histogram; std::vector std_hist (hist, hist + size_feat); @@ -289,7 +285,7 @@ template class Distance, typename PointInT, typename FeatureT> oh.correspondences_to_inputcloud = corr; oh.correspondences_to_inputcloud->push_back (pcl::Correspondence (0, static_cast (idx), distances[0][0])); - boost::shared_ptr < std::vector > feat_dist (new std::vector); + std::shared_ptr> feat_dist (new std::vector); feat_dist->push_back (distances[0][0]); oh.feature_distances_ = feat_dist; @@ -298,13 +294,9 @@ template class Distance, typename PointInT, typename FeatureT> } } - typename std::map::iterator it_map; - - std::vector feature_distance_avg; - { //pcl::ScopeTime t("Geometric verification, RANSAC and transform estimation"); - for (it_map = object_hypotheses.begin (); it_map != object_hypotheses.end (); it_map++) + for (auto it_map = object_hypotheses.cbegin (); it_map != object_hypotheses.cend (); it_map++) { std::vector < pcl::Correspondences > corresp_clusters; cg_algorithm_->setSceneCloud (keypoints_pointcloud); @@ -319,16 +311,16 @@ template class Distance, typename PointInT, typename FeatureT> { //sort the hypotheses for each model according to their correspondences and take those that are threshold_accept_model_hypothesis_ over the max cardinality int max_cardinality = -1; - for (size_t i = 0; i < corresp_clusters.size (); i++) + for (const auto &corresp_cluster : corresp_clusters) { //std::cout << (corresp_clusters[i]).size() << " -- " << (*(*it_map).second.correspondences_to_inputcloud).size() << std::endl; - if (max_cardinality < static_cast (corresp_clusters[i].size ())) + if (max_cardinality < static_cast (corresp_cluster.size ())) { - max_cardinality = static_cast (corresp_clusters[i].size ()); + max_cardinality = static_cast (corresp_cluster.size ()); } } - for (size_t i = 0; i < corresp_clusters.size (); i++) + for (std::size_t i = 0; i < corresp_clusters.size (); i++) { if (static_cast ((corresp_clusters[i]).size ()) < (threshold_accept_model_hypothesis_ * static_cast (max_cardinality))) { @@ -337,7 +329,7 @@ template class Distance, typename PointInT, typename FeatureT> } } - for (size_t i = 0; i < corresp_clusters.size (); i++) + for (std::size_t i = 0; i < corresp_clusters.size (); i++) { if (!good_indices_for_hypothesis[i]) @@ -417,7 +409,7 @@ template class Distance, typename PointInT, typename FeatureT> std::vector::ConstPtr> aligned_models; aligned_models.resize (models_->size ()); - for (size_t i = 0; i < models_->size (); i++) + for (std::size_t i = 0; i < models_->size (); i++) { ConstPointInTPtr model_cloud = models_->at (i).getAssembled (0.0025f); //ConstPointInTPtr model_cloud = models_->at (i).getAssembled (VOXEL_SIZE_ICP_); @@ -432,13 +424,13 @@ template class Distance, typename PointInT, typename FeatureT> hv_algorithm_->verify (); hv_algorithm_->getMask (mask_hv); - boost::shared_ptr < std::vector > models_temp; - boost::shared_ptr < std::vector > > transforms_temp; + std::shared_ptr> models_temp; + std::shared_ptr>> transforms_temp; models_temp.reset (new std::vector); transforms_temp.reset (new std::vector >); - for (size_t i = 0; i < models_->size (); i++) + for (std::size_t i = 0; i < models_->size (); i++) { if (!mask_hv[i]) continue; @@ -460,11 +452,11 @@ template class Distance, typename PointInT, typename FeatureT> if (use_cache_) { - typedef std::pair mv_pair; + using mv_pair = std::pair; mv_pair pair_model_view = std::make_pair (model.id_, view_id); std::map, + std::less<>, Eigen::aligned_allocator > >::iterator it = poses_cache_.find (pair_model_view); if (it != poses_cache_.end ()) diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h index 0b55f251..25e23b23 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/pipeline/local_recognizer.h @@ -5,11 +5,9 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_LOCAL_RECOGNIZER_H_ -#define REC_FRAMEWORK_LOCAL_RECOGNIZER_H_ +#pragma once -//#include -#include +#include #include #include #include @@ -40,11 +38,11 @@ namespace pcl class PCL_EXPORTS LocalRecognitionPipeline { - typedef typename pcl::PointCloud::Ptr PointInTPtr; - typedef typename pcl::PointCloud::ConstPtr ConstPointInTPtr; + using PointInTPtr = typename pcl::PointCloud::Ptr; + using ConstPointInTPtr = typename pcl::PointCloud::ConstPtr; - typedef Distance DistT; - typedef Model ModelT; + using DistT = Distance; + using ModelT = Model; /** \brief Directory where the trained structure will be saved */ std::string training_dir_; @@ -53,16 +51,16 @@ namespace pcl PointInTPtr input_; /** \brief Model data source */ - typename boost::shared_ptr > source_; + std::shared_ptr> source_; /** \brief Computes a feature */ - typename boost::shared_ptr > estimator_; + std::shared_ptr> estimator_; /** \brief Point-to-point correspondence grouping algorithm */ - typename boost::shared_ptr > cg_algorithm_; + std::shared_ptr> cg_algorithm_; /** \brief Hypotheses verification algorithm */ - typename boost::shared_ptr > hv_algorithm_; + std::shared_ptr> hv_algorithm_; /** \brief Descriptor name */ std::string descr_name_; @@ -89,15 +87,15 @@ namespace pcl bool use_cache_; std::map, Eigen::Matrix4f, - std::less >, + std::less<>, Eigen::aligned_allocator, Eigen::Matrix4f> > > poses_cache_; std::map, typename pcl::PointCloud::Ptr> keypoints_cache_; float threshold_accept_model_hypothesis_; int ICP_iterations_; - boost::shared_ptr > models_; - boost::shared_ptr > > transforms_; + std::shared_ptr> models_; + std::shared_ptr>> transforms_; int kdtree_splits_; float VOXEL_SIZE_ICP_; @@ -118,8 +116,8 @@ namespace pcl flann::Matrix flann_data (new float[models.size () * models[0].descr.size ()], models.size (), models[0].descr.size ()); - for (size_t i = 0; i < data.rows; ++i) - for (size_t j = 0; j < data.cols; ++j) + for (std::size_t i = 0; i < data.rows; ++i) + for (std::size_t j = 0; j < data.cols; ++j) { flann_data.ptr ()[i * data.cols + j] = models[i].descr[j]; } @@ -135,7 +133,7 @@ namespace pcl public: ModelT model_; typename pcl::PointCloud::Ptr correspondences_pointcloud; //points in model coordinates - boost::shared_ptr > feature_distances_; + std::shared_ptr > feature_distances_; pcl::CorrespondencesPtr correspondences_to_inputcloud; //indices between correspondences_pointcloud and scene cloud }; @@ -159,7 +157,7 @@ namespace pcl pcl::visualization::PointCloudColorHandlerCustom random_handler_sampled (cloud_sampled, 0, 0, 255); vis_corresp_.addPointCloud (cloud_sampled, random_handler_sampled, "sampled"); - for (size_t kk = 0; kk < correspondences.size (); kk++) + for (std::size_t kk = 0; kk < correspondences.size (); kk++) { pcl::PointXYZ p; p.getVector4fMap () = oh.correspondences_pointcloud->points[correspondences[kk].index_query].getVector4fMap (); @@ -242,13 +240,13 @@ namespace pcl use_cache_ = u; } - boost::shared_ptr > + std::shared_ptr> getModels () { return models_; } - boost::shared_ptr > > + std::shared_ptr>> getTransforms () { return transforms_; @@ -258,12 +256,12 @@ namespace pcl * \brief Sets the model data source_ */ void - setDataSource (typename boost::shared_ptr > & source) + setDataSource (std::shared_ptr>& source) { source_ = source; } - typename boost::shared_ptr > + std::shared_ptr> getDataSource () { return source_; @@ -273,7 +271,7 @@ namespace pcl * \brief Sets the local feature estimator */ void - setFeatureEstimator (typename boost::shared_ptr > & feat) + setFeatureEstimator (std::shared_ptr>& feat) { estimator_ = feat; } @@ -282,7 +280,7 @@ namespace pcl * \brief Sets the CG algorithm */ void - setCGAlgorithm (typename boost::shared_ptr > & alg) + setCGAlgorithm (std::shared_ptr>& alg) { cg_algorithm_ = alg; } @@ -291,7 +289,7 @@ namespace pcl * \brief Sets the HV algorithm */ void - setHVAlgorithm (typename boost::shared_ptr > & alg) + setHVAlgorithm (std::shared_ptr>& alg) { hv_algorithm_ = alg; } @@ -350,5 +348,3 @@ namespace pcl }; } } - -#endif /* REC_FRAMEWORK_LOCAL_RECOGNIZER_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h index 1ef7b0c9..e8d54009 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/tools/openni_frame_source.h @@ -1,16 +1,17 @@ -#ifndef OPENNI_CAPTURE_H -#define OPENNI_CAPTURE_H +#pragma once #include #include +#include + namespace OpenNIFrameSource { - typedef pcl::PointXYZRGBA PointT; - typedef pcl::PointCloud PointCloud; - typedef pcl::PointCloud::Ptr PointCloudPtr; - typedef pcl::PointCloud::ConstPtr PointCloudConstPtr; + using PointT = pcl::PointXYZRGBA; + using PointCloud = pcl::PointCloud; + using PointCloudPtr = pcl::PointCloud::Ptr; + using PointCloudConstPtr = pcl::PointCloud::ConstPtr; /* A simple class for capturing data from an OpenNI camera */ class PCL_EXPORTS OpenNIFrameSource @@ -33,10 +34,8 @@ namespace OpenNIFrameSource pcl::OpenNIGrabber grabber_; PointCloudPtr most_recent_frame_; int frame_counter_; - boost::mutex mutex_; + std::mutex mutex_; bool active_; }; } - -#endif diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/metrics.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/metrics.h index ea8db440..b43eafad 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/metrics.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/metrics.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_METRICS_H_ -#define REC_FRAMEWORK_METRICS_H_ +#pragma once #include #include @@ -18,45 +17,45 @@ namespace Metrics template struct Accumulator { - typedef T Type; + using Type = T; }; template<> struct Accumulator { - typedef float Type; + using Type = float; }; template<> struct Accumulator { - typedef float Type; + using Type = float; }; template<> struct Accumulator { - typedef float Type; + using Type = float; }; template<> struct Accumulator { - typedef float Type; + using Type = float; }; template<> struct Accumulator { - typedef float Type; + using Type = float; }; template<> struct Accumulator { - typedef float Type; + using Type = float; }; template struct HistIntersectionUnionDistance { - typedef T ElementType; - typedef typename Accumulator::Type ResultType; + using ElementType = T; + using ResultType = typename Accumulator::Type; /** * Compute a distance between two vectors using (1 - (1 + sum(min(a_i,b_i))) / (1 + sum(max(a_i, b_i))) ) @@ -67,7 +66,7 @@ namespace Metrics template ResultType - operator() (Iterator1 a, Iterator2 b, size_t size, ResultType worst_dist = -1) const + operator() (Iterator1 a, Iterator2 b, std::size_t size, ResultType worst_dist = -1) const { (void)worst_dist; ResultType result = ResultType (); @@ -133,5 +132,3 @@ namespace Metrics } }; } - -#endif /* REC_FRAMEWORK_METRICS_H_ */ diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h index af493862..0f970e83 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/persistence_utils.h @@ -11,7 +11,7 @@ namespace pcl { inline bool - writeCentroidToFile (std::string file, Eigen::Vector3f & centroid) + writeCentroidToFile (const std::string& file, Eigen::Vector3f & centroid) { std::ofstream out (file.c_str ()); if (!out) @@ -27,7 +27,7 @@ namespace pcl } inline bool - getCentroidFromFile (std::string file, Eigen::Vector3f & centroid) + getCentroidFromFile (const std::string& file, Eigen::Vector3f & centroid) { std::ifstream in; in.open (file.c_str (), std::ifstream::in); @@ -45,7 +45,7 @@ namespace pcl } inline bool - writeMatrixToFile (std::string file, Eigen::Matrix4f & matrix) + writeMatrixToFile (const std::string& file, Eigen::Matrix4f & matrix) { std::ofstream out (file.c_str ()); if (!out) @@ -54,9 +54,9 @@ namespace pcl return false; } - for (size_t i = 0; i < 4; i++) + for (std::size_t i = 0; i < 4; i++) { - for (size_t j = 0; j < 4; j++) + for (std::size_t j = 0; j < 4; j++) { out << matrix (i, j); if (!(i == 3 && j == 3)) @@ -69,7 +69,7 @@ namespace pcl } inline bool - writeFloatToFile (std::string file, float value) + writeFloatToFile (const std::string& file, float value) { std::ofstream out (file.c_str ()); if (!out) @@ -100,14 +100,14 @@ namespace pcl } inline bool - readFloatFromFile (std::string dir, std::string file, float& value) + readFloatFromFile (const std::string& dir, std::string file, float& value) { std::vector < std::string > strs; boost::split (strs, file, boost::is_any_of ("/")); std::string str; - for (size_t i = 0; i < (strs.size () - 1); i++) + for (std::size_t i = 0; i < (strs.size () - 1); i++) { str += strs[i] + "/"; } @@ -126,7 +126,7 @@ namespace pcl } inline bool - readFloatFromFile (std::string file, float& value) + readFloatFromFile (const std::string& file, float& value) { std::ifstream in; @@ -149,7 +149,7 @@ namespace pcl std::string dname = path[path.size () - 1]; std::string file_replaced; - for (size_t i = 0; i < (path.size () - 1); i++) + for (std::size_t i = 0; i < (path.size () - 1); i++) { file_replaced += path[i] + "/"; } @@ -157,7 +157,7 @@ namespace pcl boost::split (path, file, boost::is_any_of ("/")); std::string id; - for (size_t i = 0; i < (path.size () - 1); i++) + for (std::size_t i = 0; i < (path.size () - 1); i++) { id += path[i]; if (i < (path.size () - 1)) @@ -191,7 +191,7 @@ namespace pcl } inline bool - readMatrixFromFile (std::string file, Eigen::Matrix4f & matrix) + readMatrixFromFile (const std::string& file, Eigen::Matrix4f & matrix) { std::ifstream in; @@ -212,7 +212,7 @@ namespace pcl } inline bool - readMatrixFromFile2 (std::string file, Eigen::Matrix4f & matrix) + readMatrixFromFile2 (const std::string& file, Eigen::Matrix4f & matrix) { std::ifstream in; @@ -244,7 +244,7 @@ namespace pcl std::string dname = path[path.size () - 1]; std::string file_replaced; - for (size_t i = 0; i < (path.size () - 1); i++) + for (std::size_t i = 0; i < (path.size () - 1); i++) { file_replaced += path[i] + "/"; } @@ -252,7 +252,7 @@ namespace pcl boost::split (path, file, boost::is_any_of ("/")); std::string id; - for (size_t i = 0; i < (path.size () - 1); i++) + for (std::size_t i = 0; i < (path.size () - 1); i++) { id += path[i]; if (i < (path.size () - 1)) diff --git a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h index 46df24a8..b9095b09 100644 --- a/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h +++ b/apps/3d_rec_framework/include/pcl/apps/3d_rec_framework/utils/vtk_model_sampling.h @@ -5,8 +5,7 @@ * Author: aitor */ -#ifndef REC_FRAMEWORK_UNIFORM_SAMPLING_H_ -#define REC_FRAMEWORK_UNIFORM_SAMPLING_H_ +#pragma once #include #include @@ -63,10 +62,10 @@ namespace pcl double A[3], B[3], C[3]; vtkIdType npts = 0; - vtkIdType *ptIds = NULL; + vtkIdType *ptIds = nullptr; polydata->GetCellPoints (el, npts, ptIds); - if (ptIds == NULL) + if (ptIds == nullptr) return; polydata->GetPoint (ptIds[0], A); @@ -77,15 +76,15 @@ namespace pcl template inline void - uniform_sampling (vtkSmartPointer polydata, size_t n_samples, typename pcl::PointCloud & cloud_out) + uniform_sampling (const vtkSmartPointer& polydata, std::size_t n_samples, typename pcl::PointCloud & cloud_out) { polydata->BuildCells (); vtkSmartPointer < vtkCellArray > cells = polydata->GetPolys (); double p1[3], p2[3], p3[3], totalArea = 0; std::vector cumulativeAreas (cells->GetNumberOfCells (), 0); - size_t i = 0; - vtkIdType npts = 0, *ptIds = NULL; + std::size_t i = 0; + vtkIdType npts = 0, *ptIds = nullptr; for (cells->InitTraversal (); cells->GetNextCell (npts, ptIds); i++) { polydata->GetPoint (ptIds[0], p1); @@ -111,7 +110,7 @@ namespace pcl template inline void - uniform_sampling (std::string & file, size_t n_samples, typename pcl::PointCloud & cloud_out, float scale = 1.f) + uniform_sampling (std::string & file, std::size_t n_samples, typename pcl::PointCloud & cloud_out, float scale = 1.f) { vtkSmartPointer < vtkPLYReader > reader = vtkSmartPointer::New (); @@ -143,7 +142,7 @@ namespace pcl } inline void - getVerticesAsPointCloud (vtkSmartPointer polydata, pcl::PointCloud & cloud_out) + getVerticesAsPointCloud (const vtkSmartPointer& polydata, pcl::PointCloud & cloud_out) { vtkPoints *points = polydata->GetPoints (); cloud_out.points.resize (points->GetNumberOfPoints ()); @@ -151,7 +150,7 @@ namespace pcl cloud_out.height = 1; cloud_out.is_dense = false; - for (int i = 0; i < points->GetNumberOfPoints (); i++) + for (vtkIdType i = 0; i < points->GetNumberOfPoints (); i++) { double p[3]; points->GetPoint (i, p); @@ -162,5 +161,3 @@ namespace pcl } } } - -#endif /* REC_FRAMEWORK_UNIFORM_SAMPLING_H_ */ diff --git a/apps/3d_rec_framework/tools/apps/src/global_classification.cpp b/apps/3d_rec_framework/src/tools/global_classification.cpp similarity index 73% rename from apps/3d_rec_framework/tools/apps/src/global_classification.cpp rename to apps/3d_rec_framework/src/tools/global_classification.cpp index e21f1f43..0a266991 100644 --- a/apps/3d_rec_framework/tools/apps/src/global_classification.cpp +++ b/apps/3d_rec_framework/src/tools/global_classification.cpp @@ -28,11 +28,13 @@ segmentAndClassify (typename pcl::rec_3d_framework::GlobalNNPipeline keyboard_cb = boost::bind (&OpenNIFrameSource::OpenNIFrameSource::onKeyboardEvent, &camera, _1); + std::function keyboard_cb = [&] (const pcl::visualization::KeyboardEvent& event) + { + camera.onKeyboardEvent (event); + }; vis.registerKeyboardCallback (keyboard_cb); - size_t previous_cluster_size = 0; - size_t previous_categories_size = 0; + std::size_t previous_cluster_size = 0; + std::size_t previous_categories_size = 0; float Z_DIST_ = 1.25f; float text_scale = 0.015f; @@ -66,7 +68,7 @@ segmentAndClassify (typename pcl::rec_3d_framework::GlobalNNPipeline (frame, "frame"); - for (size_t i = 0; i < previous_cluster_size; i++) + for (std::size_t i = 0; i < previous_cluster_size; i++) { std::stringstream cluster_name; cluster_name << "cluster_" << i; @@ -76,7 +78,7 @@ segmentAndClassify (typename pcl::rec_3d_framework::GlobalNNPipeline > mesh_source (new pcl::rec_3d_framework::MeshSource); + std::shared_ptr> mesh_source (new pcl::rec_3d_framework::MeshSource); mesh_source->setPath (path); mesh_source->setResolution (150); mesh_source->setTesselationLevel (1); @@ -159,24 +160,27 @@ main (int argc, char ** argv) mesh_source->setModelScale (1.f); mesh_source->generate (training_dir); - boost::shared_ptr > cast_source; - cast_source = boost::static_pointer_cast > (mesh_source); + std::shared_ptr> cast_source ( + std::static_pointer_cast> (mesh_source) + ); - boost::shared_ptr > normal_estimator; + std::shared_ptr> normal_estimator; normal_estimator.reset (new pcl::rec_3d_framework::PreProcessorAndNormalEstimator); normal_estimator->setCMR (true); normal_estimator->setDoVoxelGrid (true); normal_estimator->setRemoveOutliers (true); normal_estimator->setFactorsForCMR (3, 7); - if (desc_name.compare ("vfh") == 0) + if (desc_name == "vfh") { - boost::shared_ptr > vfh_estimator; - vfh_estimator.reset (new pcl::rec_3d_framework::VFHEstimation); + std::shared_ptr> vfh_estimator ( + new pcl::rec_3d_framework::VFHEstimation + ); vfh_estimator->setNormalEstimator (normal_estimator); - boost::shared_ptr > cast_estimator; - cast_estimator = boost::dynamic_pointer_cast > (vfh_estimator); + std::shared_ptr> cast_estimator ( + std::dynamic_pointer_cast> (vfh_estimator) + ); pcl::rec_3d_framework::GlobalNNPipeline global; global.setDataSource (cast_source); @@ -189,14 +193,16 @@ main (int argc, char ** argv) segmentAndClassify (global); } - if (desc_name.compare ("cvfh") == 0) + if (desc_name == "cvfh") { - boost::shared_ptr > vfh_estimator; - vfh_estimator.reset (new pcl::rec_3d_framework::CVFHEstimation); + std::shared_ptr> vfh_estimator ( + new pcl::rec_3d_framework::CVFHEstimation + ); vfh_estimator->setNormalEstimator (normal_estimator); - boost::shared_ptr > cast_estimator; - cast_estimator = boost::dynamic_pointer_cast > (vfh_estimator); + std::shared_ptr> cast_estimator ( + std::dynamic_pointer_cast> (vfh_estimator) + ); pcl::rec_3d_framework::GlobalNNPipeline global; global.setDataSource (cast_source); @@ -209,13 +215,15 @@ main (int argc, char ** argv) segmentAndClassify (global); } - if (desc_name.compare ("esf") == 0) + if (desc_name == "esf") { - boost::shared_ptr > estimator; - estimator.reset (new pcl::rec_3d_framework::ESFEstimation); + std::shared_ptr> estimator ( + new pcl::rec_3d_framework::ESFEstimation + ); - boost::shared_ptr > cast_estimator; - cast_estimator = boost::dynamic_pointer_cast > (estimator); + std::shared_ptr> cast_estimator ( + std::dynamic_pointer_cast> (estimator) + ); pcl::rec_3d_framework::GlobalNNPipeline global; global.setDataSource (cast_source); diff --git a/apps/3d_rec_framework/tools/apps/src/local_recognition_mian_dataset.cpp b/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp similarity index 67% rename from apps/3d_rec_framework/tools/apps/src/local_recognition_mian_dataset.cpp rename to apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp index 9efd874b..3c5332ad 100644 --- a/apps/3d_rec_framework/tools/apps/src/local_recognition_mian_dataset.cpp +++ b/apps/3d_rec_framework/src/tools/local_recognition_mian_dataset.cpp @@ -4,6 +4,9 @@ * Created on: Mar 24, 2012 * Author: aitor */ + +#include + #include #include #include @@ -24,43 +27,27 @@ void getScenesInDirectory (bf::path & dir, std::string & rel_path_so_far, std::vector & relative_paths) { //list models in MODEL_FILES_DIR_ and return list - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (dir); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(dir)) { //check if its a directory, then get models in it - if (bf::is_directory (*itr)) + if (bf::is_directory (dir_entry)) { - -#if BOOST_FILESYSTEM_VERSION == 3 - std::string so_far = rel_path_so_far + (itr->path ().filename ()).string() + "/"; -#else - std::string so_far = rel_path_so_far + (itr->path ()).filename () + "/"; -#endif - bf::path curr_path = itr->path (); + std::string so_far = rel_path_so_far + (dir_entry.path ().filename ()).string() + "/"; + bf::path curr_path = dir_entry.path (); getScenesInDirectory (curr_path, so_far, relative_paths); } else { //check that it is a ply file and then add, otherwise ignore.. std::vector < std::string > strs; -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file = (itr->path ().filename ()).string(); -#else - std::string file = (itr->path ().filename ()); -#endif + std::string file = (dir_entry.path ().filename ()).string(); boost::split (strs, file, boost::is_any_of (".")); std::string extension = strs[strs.size () - 1]; if (extension == "pcd") { - -#if BOOST_FILESYSTEM_VERSION == 3 - std::string path = rel_path_so_far + (itr->path ().filename ()).string(); -#else - std::string path = rel_path_so_far + (itr->path ()).filename (); -#endif - + std::string path = rel_path_so_far + (dir_entry.path ().filename ()).string(); relative_paths.push_back (path); } } @@ -79,8 +66,8 @@ sortFiles (const std::string & file1, const std::string & file2) std::string id_1 = strs1[strs1.size () - 1]; std::string id_2 = strs2[strs2.size () - 1]; - size_t pos1 = id_1.find (".ply.pcd"); - size_t pos2 = id_2.find (".ply.pcd"); + std::size_t pos1 = id_1.find (".ply.pcd"); + std::size_t pos2 = id_2.find (".ply.pcd"); id_1 = id_1.substr (0, pos1); id_2 = id_2.substr (0, pos2); @@ -100,24 +87,23 @@ template class DistT, typename PointT, typename FeatureT> //read mians scenes bf::path ply_files_dir = scenes_dir; std::vector < std::string > files; - std::string start = ""; + std::string start; getScenesInDirectory (ply_files_dir, start, files); std::sort (files.begin (), files.end (), sortFiles); - typename boost::shared_ptr > model_source_ = local.getDataSource (); - typedef typename pcl::PointCloud::ConstPtr ConstPointInTPtr; - typedef pcl::rec_3d_framework::Model ModelT; + auto model_source_ = local.getDataSource (); + using ConstPointInTPtr = typename pcl::PointCloud::ConstPtr; if (!single_model) { pcl::visualization::PCLVisualizer vis ("Mians dataset"); - for (size_t i = 0; i < files.size (); i++) + for (std::size_t i = 0; i < files.size (); i++) { std::cout << files[i] << std::endl; if (scene != -1) - if ((size_t) scene != i) + if ((std::size_t) scene != i) continue; std::stringstream file; @@ -139,10 +125,10 @@ template class DistT, typename PointT, typename FeatureT> vis.addText (scene_name.str (), 1, 30, 24, 1, 0, 0, "scene_text"); //visualize results - boost::shared_ptr < std::vector > models = local.getModels (); - boost::shared_ptr < std::vector > > transforms = local.getTransforms (); + auto models = local.getModels (); + auto transforms = local.getTransforms (); - for (size_t j = 0; j < models->size (); j++) + for (std::size_t j = 0; j < models->size (); j++) { std::stringstream name; name << "cloud_" << j; @@ -157,19 +143,19 @@ template class DistT, typename PointT, typename FeatureT> g = 0.0f; b = 0.0f; - if (models->at (j).id_.compare ("cheff") == 0) + if (models->at (j).id_ == "cheff") { r = 0.0f; g = 255.0f; b = 0.0f; } - else if (models->at (j).id_.compare ("chicken_high") == 0) + else if (models->at (j).id_ == "chicken_high") { r = 0.0f; g = 255.0f; b = 255.0f; } - else if (models->at (j).id_.compare ("parasaurolophus_high") == 0) + else if (models->at (j).id_ == "parasaurolophus_high") { r = 255.0f; g = 255.0f; @@ -188,7 +174,7 @@ template class DistT, typename PointT, typename FeatureT> vis.removePointCloud ("scene_cloud"); vis.removeShape ("scene_text"); - for (size_t j = 0; j < models->size (); j++) + for (std::size_t j = 0; j < models->size (); j++) { std::stringstream name; name << "cloud_" << j; @@ -205,7 +191,7 @@ template class DistT, typename PointT, typename FeatureT> local.setSearchModel (id); local.initialize (); - for (size_t i = 0; i < files.size (); i++) + for (std::size_t i = 0; i < files.size (); i++) { std::stringstream file; file << ply_files_dir.string () << files[i]; @@ -222,10 +208,10 @@ template class DistT, typename PointT, typename FeatureT> vis.addText (scene_name.str (), 1, 30, 24, 1, 0, 0, "scene_text"); //visualize results - boost::shared_ptr < std::vector > models = local.getModels (); - boost::shared_ptr < std::vector > > transforms = local.getTransforms (); + auto models = local.getModels (); + auto transforms = local.getTransforms (); - for (size_t j = 0; j < models->size (); j++) + for (std::size_t j = 0; j < models->size (); j++) { std::stringstream name; name << "cloud_" << j; @@ -242,7 +228,7 @@ template class DistT, typename PointT, typename FeatureT> vis.removePointCloud ("scene_cloud"); vis.removeShape ("scene_text"); - for (size_t j = 0; j < models->size (); j++) + for (std::size_t j = 0; j < models->size (); j++) { std::stringstream name; name << "cloud_" << j; @@ -255,41 +241,28 @@ template class DistT, typename PointT, typename FeatureT> void getModelsInDirectory (bf::path & dir, std::string & rel_path_so_far, std::vector & relative_paths, std::string & ext) { - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (dir); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(dir)) { //check if its a directory, then get models in it - if (bf::is_directory (*itr)) + if (bf::is_directory (dir_entry)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string so_far = rel_path_so_far + (itr->path ().filename ()).string() + "/"; -#else - std::string so_far = rel_path_so_far + (itr->path ()).filename () + "/"; -#endif + std::string so_far = rel_path_so_far + (dir_entry.path ().filename ()).string() + "/"; - bf::path curr_path = itr->path (); + bf::path curr_path = dir_entry.path (); getModelsInDirectory (curr_path, so_far, relative_paths, ext); } else { //check that it is a ply file and then add, otherwise ignore.. std::vector < std::string > strs; -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file = (itr->path ().filename ()).string(); -#else - std::string file = (itr->path ()).filename (); -#endif + std::string file = (dir_entry.path ().filename ()).string(); boost::split (strs, file, boost::is_any_of (".")); std::string extension = strs[strs.size () - 1]; - if (extension.compare (ext) == 0) + if (extension == ext) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string path = rel_path_so_far + (itr->path ().filename ()).string(); -#else - std::string path = rel_path_so_far + (itr->path ()).filename (); -#endif + std::string path = rel_path_so_far + (dir_entry.path ().filename ()).string(); relative_paths.push_back (path); } @@ -297,7 +270,7 @@ getModelsInDirectory (bf::path & dir, std::string & rel_path_so_far, std::vector } } -typedef pcl::ReferenceFrame RFType; +using RFType = pcl::ReferenceFrame; int CG_SIZE_ = 3; float CG_THRESHOLD_ = 0.005f; @@ -314,10 +287,10 @@ float CG_THRESHOLD_ = 0.005f; int main (int argc, char ** argv) { - std::string path = ""; + std::string path; std::string desc_name = "shot_omp"; std::string training_dir = "trained_models/"; - std::string mians_scenes = ""; + std::string mians_scenes; int force_retrain = 0; int icp_iterations = 20; int use_cache = 1; @@ -345,13 +318,13 @@ main (int argc, char ** argv) pcl::console::parse_argument (argc, argv, "-use_hv", use_hv); pcl::console::parse_argument (argc, argv, "-thres_hyp", thres_hyp_); - if (mians_scenes.compare ("") == 0) + if (mians_scenes.empty()) { PCL_ERROR("Set the directory containing mians scenes using the -mians_scenes_dir [dir] option\n"); return -1; } - if (path.compare ("") == 0) + if (path.empty()) { PCL_ERROR("Set the directory containing the models of mian dataset using the -models_dir [dir] option\n"); return -1; @@ -363,18 +336,15 @@ main (int argc, char ** argv) PCL_ERROR("Models dir path %s does not exist, use -models_dir [dir] option\n", path.c_str()); return -1; } - else - { - std::vector < std::string > files; - std::string start = ""; - std::string ext = std::string ("ply"); - bf::path dir = models_dir_path; - getModelsInDirectory (dir, start, files, ext); - assert (files.size () == 4); - } + std::vector < std::string > files; + std::string start; + std::string ext = std::string ("ply"); + bf::path dir = models_dir_path; + getModelsInDirectory (dir, start, files, ext); + assert (files.size () == 4); //configure mesh source - boost::shared_ptr > mesh_source (new pcl::rec_3d_framework::MeshSource); + std::shared_ptr> mesh_source (new pcl::rec_3d_framework::MeshSource); mesh_source->setPath (path); mesh_source->setResolution (250); mesh_source->setTesselationLevel (1); @@ -383,11 +353,12 @@ main (int argc, char ** argv) mesh_source->setModelScale (0.001f); mesh_source->generate (training_dir); - boost::shared_ptr > cast_source; - cast_source = boost::static_pointer_cast > (mesh_source); + std::shared_ptr> cast_source ( + std::static_pointer_cast> (mesh_source) + ); //configure normal estimator - boost::shared_ptr > normal_estimator; + std::shared_ptr > normal_estimator; normal_estimator.reset (new pcl::rec_3d_framework::PreProcessorAndNormalEstimator); normal_estimator->setCMR (false); normal_estimator->setDoVoxelGrid (true); @@ -395,28 +366,28 @@ main (int argc, char ** argv) normal_estimator->setValuesForCMRFalse (0.003f, 0.012f); //configure keypoint extractor - boost::shared_ptr > - uniform_keypoint_extractor ( - new pcl::rec_3d_framework::UniformSamplingExtractor< - pcl::PointXYZ>); + std::shared_ptr> uniform_keypoint_extractor ( + new pcl::rec_3d_framework::UniformSamplingExtractor + ); //uniform_keypoint_extractor->setSamplingDensity (0.01f); uniform_keypoint_extractor->setSamplingDensity (0.005f); uniform_keypoint_extractor->setFilterPlanar (true); - boost::shared_ptr > keypoint_extractor; - keypoint_extractor = boost::static_pointer_cast > (uniform_keypoint_extractor); + std::shared_ptr> keypoint_extractor ( + std::static_pointer_cast> (uniform_keypoint_extractor) + ); //configure cg algorithm (geometric consistency grouping) - boost::shared_ptr > cast_cg_alg; - boost::shared_ptr > gcg_alg ( + std::shared_ptr> cast_cg_alg; + std::shared_ptr > gcg_alg ( new pcl::GeometricConsistencyGrouping); gcg_alg->setGCThreshold (CG_SIZE_); gcg_alg->setGCSize (CG_THRESHOLD_); - cast_cg_alg = boost::static_pointer_cast > (gcg_alg); + cast_cg_alg = std::static_pointer_cast> (gcg_alg); //configure hypothesis verificator - boost::shared_ptr > papazov (new pcl::PapazovHV); + std::shared_ptr> papazov (new pcl::PapazovHV); papazov->setResolution (0.005f); papazov->setInlierThreshold (0.005f); papazov->setSupportThreshold (0.08f); @@ -424,9 +395,9 @@ main (int argc, char ** argv) papazov->setConflictThreshold (0.02f); papazov->setOcclusionThreshold (0.01f); - boost::shared_ptr > go ( - new pcl::GlobalHypothesesVerification); + std::shared_ptr> go ( + new pcl::GlobalHypothesesVerification + ); go->setResolution (0.005f); go->setMaxIterations (7000); go->setInlierThreshold (0.005f); @@ -436,35 +407,36 @@ main (int argc, char ** argv) go->setDetectClutter (detect_clutter); go->setOcclusionThreshold (0.01f); - boost::shared_ptr > greedy (new pcl::GreedyVerification (3.f)); + std::shared_ptr> greedy (new pcl::GreedyVerification (3.f)); greedy->setResolution (0.005f); greedy->setInlierThreshold (0.005f); greedy->setOcclusionThreshold (0.01f); - boost::shared_ptr > cast_hv_alg; + std::shared_ptr> cast_hv_alg; switch (hv_method) { case 1: - cast_hv_alg = boost::static_pointer_cast > (greedy); + cast_hv_alg = std::static_pointer_cast> (greedy); break; case 2: - cast_hv_alg = boost::static_pointer_cast > (papazov); + cast_hv_alg = std::static_pointer_cast> (papazov); break; default: - cast_hv_alg = boost::static_pointer_cast > (go); + cast_hv_alg = std::static_pointer_cast> (go); } - if (desc_name.compare ("shot") == 0) + if (desc_name == "shot") { - boost::shared_ptr > > estimator; + std::shared_ptr>> estimator; estimator.reset (new pcl::rec_3d_framework::SHOTLocalEstimation >); estimator->setNormalEstimator (normal_estimator); estimator->addKeypointExtractor (keypoint_extractor); estimator->setSupportRadius (0.04f); - boost::shared_ptr > > cast_estimator; - cast_estimator = boost::dynamic_pointer_cast > > (estimator); + std::shared_ptr>> cast_estimator ( + std::dynamic_pointer_cast>> (estimator) + ); pcl::rec_3d_framework::LocalRecognitionPipeline > local; local.setDataSource (cast_source); @@ -485,18 +457,19 @@ main (int argc, char ** argv) } - if (desc_name.compare ("shot_omp") == 0) + if (desc_name == "shot_omp") { desc_name = std::string ("shot"); - boost::shared_ptr > > estimator; + std::shared_ptr>> estimator; estimator.reset (new pcl::rec_3d_framework::SHOTLocalEstimationOMP >); estimator->setNormalEstimator (normal_estimator); estimator->addKeypointExtractor (keypoint_extractor); //estimator->setSupportRadius (0.04f); estimator->setSupportRadius (desc_radius); - boost::shared_ptr > > cast_estimator; - cast_estimator = boost::dynamic_pointer_cast > > (estimator); + std::shared_ptr>> cast_estimator ( + std::dynamic_pointer_cast>> (estimator) + ); pcl::rec_3d_framework::LocalRecognitionPipeline > local; local.setDataSource (cast_source); @@ -519,16 +492,17 @@ main (int argc, char ** argv) } - if (desc_name.compare ("fpfh") == 0) + if (desc_name == "fpfh") { - boost::shared_ptr > estimator; + std::shared_ptr> estimator; estimator.reset (new pcl::rec_3d_framework::FPFHLocalEstimation); estimator->setNormalEstimator (normal_estimator); estimator->addKeypointExtractor (keypoint_extractor); estimator->setSupportRadius (0.04f); - boost::shared_ptr > cast_estimator; - cast_estimator = boost::dynamic_pointer_cast > (estimator); + std::shared_ptr> cast_estimator ( + std::dynamic_pointer_cast> (estimator) + ); pcl::rec_3d_framework::LocalRecognitionPipeline local; local.setDataSource (cast_source); diff --git a/apps/3d_rec_framework/src/tools/openni_frame_source.cpp b/apps/3d_rec_framework/src/tools/openni_frame_source.cpp index 4bf10947..0e2dde6e 100644 --- a/apps/3d_rec_framework/src/tools/openni_frame_source.cpp +++ b/apps/3d_rec_framework/src/tools/openni_frame_source.cpp @@ -1,16 +1,15 @@ #include "pcl/apps/3d_rec_framework/tools/openni_frame_source.h" #include -#include -#include +#include namespace OpenNIFrameSource { OpenNIFrameSource::OpenNIFrameSource (const std::string& device_id) : - grabber_ (device_id), most_recent_frame_ (), frame_counter_ (0), active_ (true) + grabber_ (device_id), frame_counter_ (0), active_ (true) { - boost::function frame_cb = boost::bind (&OpenNIFrameSource::onNewFrame, this, _1); + std::function frame_cb = [this] (const PointCloudConstPtr& cloud){ onNewFrame (cloud); }; grabber_.registerCallback (frame_cb); grabber_.start (); } @@ -38,7 +37,7 @@ namespace OpenNIFrameSource { mutex_.lock (); ++frame_counter_; - most_recent_frame_ = boost::make_shared (*cloud); // Make a copy of the frame + most_recent_frame_ = pcl::make_shared (*cloud); // Make a copy of the frame mutex_.unlock (); } diff --git a/apps/3d_rec_framework/tools/CMakeLists.txt b/apps/3d_rec_framework/tools/CMakeLists.txt deleted file mode 100644 index abb140ad..00000000 --- a/apps/3d_rec_framework/tools/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(apps) \ No newline at end of file diff --git a/apps/3d_rec_framework/tools/apps/CMakeLists.txt b/apps/3d_rec_framework/tools/apps/CMakeLists.txt deleted file mode 100644 index 4862fb37..00000000 --- a/apps/3d_rec_framework/tools/apps/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -if (QHULL_FOUND) - add_executable(pcl_global_classification src/global_classification.cpp) - target_link_libraries(pcl_global_classification pcl_apps pcl_3d_rec_framework pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface) -endif() - -add_executable(pcl_local_or_mian src/local_recognition_mian_dataset.cpp) -target_link_libraries(pcl_local_or_mian pcl_apps pcl_3d_rec_framework pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints) - -#add_executable(pcl_local_face src/local_recognition_faces.cpp) -#target_link_libraries(pcl_local_face pcl_apps pcl_3d_rec_framework pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints) diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index 67aec271..ce5a6ea2 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -6,238 +6,225 @@ set(DEFAULT FALSE) PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS openni vtk) -if(build) +if(NOT build) + return() +endif() - include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") +# to be filled with all targets the apps subsystem +set(PCL_APPS_ALL_TARGETS) - PCL_ADD_EXECUTABLE(pcl_test_search_speed "${SUBSYS_NAME}" src/test_search.cpp) - target_link_libraries(pcl_test_search_speed pcl_common pcl_io pcl_search pcl_kdtree pcl_visualization) +include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") - PCL_ADD_EXECUTABLE(pcl_nn_classification_example "${SUBSYS_NAME}" src/nn_classification_example.cpp) - target_link_libraries(pcl_nn_classification_example pcl_common pcl_io pcl_features pcl_kdtree) +PCL_ADD_EXECUTABLE(pcl_test_search_speed COMPONENT ${SUBSYS_NAME} SOURCES src/test_search.cpp) +target_link_libraries(pcl_test_search_speed pcl_common pcl_io pcl_search pcl_kdtree pcl_visualization) - PCL_ADD_EXECUTABLE(pcl_pyramid_surface_matching "${SUBSYS_NAME}" src/pyramid_surface_matching.cpp) - target_link_libraries(pcl_pyramid_surface_matching pcl_common pcl_io pcl_features pcl_registration pcl_filters) +PCL_ADD_EXECUTABLE(pcl_nn_classification_example COMPONENT ${SUBSYS_NAME} SOURCES src/nn_classification_example.cpp) +target_link_libraries(pcl_nn_classification_example pcl_common pcl_io pcl_features pcl_kdtree) - PCL_ADD_EXECUTABLE(pcl_statistical_multiscale_interest_region_extraction_example "${SUBSYS_NAME}" src/statistical_multiscale_interest_region_extraction_example.cpp) - target_link_libraries(pcl_statistical_multiscale_interest_region_extraction_example pcl_common pcl_io pcl_features pcl_filters) +PCL_ADD_EXECUTABLE(pcl_pyramid_surface_matching COMPONENT ${SUBSYS_NAME} SOURCES src/pyramid_surface_matching.cpp) +target_link_libraries(pcl_pyramid_surface_matching pcl_common pcl_io pcl_features pcl_registration pcl_filters) - if(LIBUSB_1_FOUND) - PCL_ADD_EXECUTABLE(pcl_dinast_grabber "${SUBSYS_NAME}" src/dinast_grabber_example.cpp) - target_link_libraries(pcl_dinast_grabber pcl_common pcl_visualization pcl_io) - endif(LIBUSB_1_FOUND) +PCL_ADD_EXECUTABLE(pcl_statistical_multiscale_interest_region_extraction_example COMPONENT ${SUBSYS_NAME} SOURCES src/statistical_multiscale_interest_region_extraction_example.cpp) +target_link_libraries(pcl_statistical_multiscale_interest_region_extraction_example pcl_common pcl_io pcl_features pcl_filters) - if (VTK_FOUND) +if(LIBUSB_1_FOUND) + PCL_ADD_EXECUTABLE(pcl_dinast_grabber COMPONENT ${SUBSYS_NAME} SOURCES src/dinast_grabber_example.cpp) + target_link_libraries(pcl_dinast_grabber pcl_common pcl_visualization pcl_io) +endif() - include("${VTK_USE_FILE}") +if(VTK_FOUND) + include("${VTK_USE_FILE}") - set(incs "include/pcl/${SUBSYS_NAME}/render_views_tesselated_sphere.h") - set(srcs "src/render_views_tesselated_sphere.cpp") + set(incs "include/pcl/${SUBSYS_NAME}/render_views_tesselated_sphere.h") + set(srcs "src/render_views_tesselated_sphere.cpp") - PCL_ADD_EXECUTABLE(pcl_ppf_object_recognition "${SUBSYS_NAME}" src/ppf_object_recognition.cpp) - target_link_libraries(pcl_ppf_object_recognition pcl_common pcl_io pcl_filters pcl_features pcl_registration pcl_visualization pcl_sample_consensus pcl_segmentation) + PCL_ADD_EXECUTABLE(pcl_ppf_object_recognition COMPONENT ${SUBSYS_NAME} SOURCES src/ppf_object_recognition.cpp) + target_link_libraries(pcl_ppf_object_recognition pcl_common pcl_io pcl_filters pcl_features pcl_registration pcl_visualization pcl_sample_consensus pcl_segmentation) - PCL_ADD_EXECUTABLE(pcl_multiscale_feature_persistence_example "${SUBSYS_NAME}" src/multiscale_feature_persistence_example.cpp) - target_link_libraries(pcl_multiscale_feature_persistence_example pcl_common pcl_io pcl_filters pcl_features pcl_visualization) + PCL_ADD_EXECUTABLE(pcl_multiscale_feature_persistence_example COMPONENT ${SUBSYS_NAME} SOURCES src/multiscale_feature_persistence_example.cpp) + target_link_libraries(pcl_multiscale_feature_persistence_example pcl_common pcl_io pcl_filters pcl_features pcl_visualization) - PCL_ADD_EXECUTABLE(pcl_surfel_smoothing_test "${SUBSYS_NAME}" src/surfel_smoothing_test.cpp) - target_link_libraries(pcl_surfel_smoothing_test pcl_common pcl_io pcl_surface pcl_filters pcl_features pcl_visualization) + PCL_ADD_EXECUTABLE(pcl_surfel_smoothing_test COMPONENT ${SUBSYS_NAME} SOURCES src/surfel_smoothing_test.cpp) + target_link_libraries(pcl_surfel_smoothing_test pcl_common pcl_io pcl_surface pcl_filters pcl_features pcl_visualization) - PCL_ADD_EXECUTABLE(pcl_feature_matching "${SUBSYS_NAME}" src/feature_matching.cpp) - target_link_libraries(pcl_feature_matching pcl_common pcl_io pcl_registration pcl_keypoints pcl_sample_consensus pcl_visualization pcl_search pcl_features pcl_kdtree pcl_surface pcl_segmentation) + PCL_ADD_EXECUTABLE(pcl_feature_matching COMPONENT ${SUBSYS_NAME} SOURCES src/feature_matching.cpp) + target_link_libraries(pcl_feature_matching pcl_common pcl_io pcl_registration pcl_keypoints pcl_sample_consensus pcl_visualization pcl_search pcl_features pcl_kdtree pcl_surface pcl_segmentation) - PCL_ADD_EXECUTABLE(pcl_convolve "${SUBSYS_NAME}" src/convolve.cpp) - target_link_libraries(pcl_convolve pcl_common pcl_io pcl_visualization) + PCL_ADD_EXECUTABLE(pcl_convolve COMPONENT ${SUBSYS_NAME} SOURCES src/convolve.cpp) + target_link_libraries(pcl_convolve pcl_common pcl_io pcl_visualization) - PCL_ADD_EXECUTABLE(pcl_pcd_organized_multi_plane_segmentation "${SUBSYS_NAME}" src/pcd_organized_multi_plane_segmentation.cpp) - target_link_libraries(pcl_pcd_organized_multi_plane_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features) + PCL_ADD_EXECUTABLE(pcl_pcd_organized_multi_plane_segmentation COMPONENT ${SUBSYS_NAME} SOURCES src/pcd_organized_multi_plane_segmentation.cpp) + target_link_libraries(pcl_pcd_organized_multi_plane_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features) - if (QHULL_FOUND) - PCL_ADD_EXECUTABLE(pcl_pcd_select_object_plane "${SUBSYS_NAME}" src/pcd_select_object_plane.cpp) - target_link_libraries(pcl_pcd_select_object_plane pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features pcl_surface) - endif() - -# PCL_ADD_EXECUTABLE(pcl_convolve "${SUBSYS_NAME}" src/convolve.cpp) -# target_link_libraries(pcl_convolve pcl_common pcl_io pcl_visualization) - - PCL_ADD_EXECUTABLE(pcl_pcd_organized_edge_detection "${SUBSYS_NAME}" src/pcd_organized_edge_detection.cpp) - target_link_libraries(pcl_pcd_organized_edge_detection pcl_common pcl_io pcl_features pcl_visualization) - - PCL_ADD_EXECUTABLE(pcl_face_trainer "${SUBSYS_NAME}" src/face_detection/face_trainer.cpp) - target_link_libraries(pcl_face_trainer pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) - - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_fs_face_detector "${SUBSYS_NAME}" src/face_detection//filesystem_face_detection.cpp) - target_link_libraries(pcl_fs_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) - - PCL_ADD_EXECUTABLE(pcl_stereo_ground_segmentation "${SUBSYS_NAME}" src/stereo_ground_segmentation.cpp) - target_link_libraries(pcl_stereo_ground_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features pcl_stereo) - - if (QT4_FOUND AND VTK_USE_QVTK) - - # Manual registration demo - QT4_WRAP_UI(manual_registration_ui src/manual_registration/manual_registration.ui) - QT4_WRAP_CPP(manual_registration_moc include/pcl/apps/manual_registration.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_manual_registration "${SUBSYS_NAME}" ${manual_registration_ui} ${manual_registration_moc} src/manual_registration/manual_registration.cpp) - target_link_libraries(pcl_manual_registration pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) - - QT4_WRAP_UI(pcd_video_player_ui src/pcd_video_player/pcd_video_player.ui) - QT4_WRAP_CPP(pcd_video_player_moc include/pcl/apps/pcd_video_player.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_pcd_video_player "${SUBSYS_NAME}" ${pcd_video_player_ui} ${pcd_video_player_moc} src/pcd_video_player/pcd_video_player.cpp) - target_link_libraries(pcl_pcd_video_player pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) - - endif (QT4_FOUND AND VTK_USE_QVTK) - - if (WITH_OPENNI) - -# PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_grab_frame "${SUBSYS_NAME}" src/openni_grab_frame.cpp) -# target_link_libraries(pcl_openni_grab_frame pcl_common pcl_io pcl_visualization) - -# PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_grab_images "${SUBSYS_NAME}" src/openni_grab_images.cpp) -# target_link_libraries(pcl_openni_grab_images pcl_common pcl_io pcl_visualization) + if(QHULL_FOUND) + PCL_ADD_EXECUTABLE(pcl_pcd_select_object_plane COMPONENT ${SUBSYS_NAME} SOURCES src/pcd_select_object_plane.cpp) + target_link_libraries(pcl_pcd_select_object_plane pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features pcl_surface) + endif() + PCL_ADD_EXECUTABLE(pcl_pcd_organized_edge_detection COMPONENT ${SUBSYS_NAME} SOURCES src/pcd_organized_edge_detection.cpp) + target_link_libraries(pcl_pcd_organized_edge_detection pcl_common pcl_io pcl_features pcl_visualization) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_fast_mesh "${SUBSYS_NAME}" src/openni_fast_mesh.cpp) - target_link_libraries(pcl_openni_fast_mesh pcl_common pcl_io pcl_visualization pcl_surface) + PCL_ADD_EXECUTABLE(pcl_face_trainer COMPONENT ${SUBSYS_NAME} SOURCES src/face_detection/face_trainer.cpp) + target_link_libraries(pcl_face_trainer pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_voxel_grid "${SUBSYS_NAME}" src/openni_voxel_grid.cpp) - target_link_libraries(pcl_openni_voxel_grid pcl_common pcl_io pcl_filters pcl_visualization) + PCL_ADD_EXECUTABLE(pcl_fs_face_detector COMPONENT ${SUBSYS_NAME} SOURCES src/face_detection//filesystem_face_detection.cpp BUNDLE) + target_link_libraries(pcl_fs_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_octree_compression "${SUBSYS_NAME}" src/openni_octree_compression.cpp) - target_link_libraries(pcl_openni_octree_compression pcl_common pcl_io pcl_filters pcl_visualization pcl_octree) + PCL_ADD_EXECUTABLE(pcl_stereo_ground_segmentation COMPONENT ${SUBSYS_NAME} SOURCES src/stereo_ground_segmentation.cpp) + target_link_libraries(pcl_stereo_ground_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features pcl_stereo) - if(HAVE_PNG) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_organized_compression "${SUBSYS_NAME}" src/openni_organized_compression.cpp) - target_link_libraries(pcl_openni_organized_compression pcl_common pcl_io pcl_filters pcl_visualization pcl_octree) - endif(HAVE_PNG) + if(Qt5_FOUND AND QVTK_FOUND) + # Manual registration demo + QT5_WRAP_UI(manual_registration_ui src/manual_registration/manual_registration.ui) + QT5_WRAP_CPP(manual_registration_moc include/pcl/apps/manual_registration.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + PCL_ADD_EXECUTABLE(pcl_manual_registration COMPONENT ${SUBSYS_NAME} SOURCES ${manual_registration_ui} ${manual_registration_moc} src/manual_registration/manual_registration.cpp BUNDLE) + target_link_libraries(pcl_manual_registration pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface Qt5::Widgets) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_shift_to_depth_conversion "${SUBSYS_NAME}" src/openni_shift_to_depth_conversion.cpp) - target_link_libraries(pcl_openni_shift_to_depth_conversion pcl_common pcl_visualization) + QT5_WRAP_UI(pcd_video_player_ui src/pcd_video_player/pcd_video_player.ui) + QT5_WRAP_CPP(pcd_video_player_moc include/pcl/apps/pcd_video_player.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + PCL_ADD_EXECUTABLE(pcl_pcd_video_player COMPONENT ${SUBSYS_NAME} SOURCES ${pcd_video_player_ui} ${pcd_video_player_moc} src/pcd_video_player/pcd_video_player.cpp BUNDLE) + target_link_libraries(pcl_pcd_video_player pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface Qt5::Widgets) + endif() - PCL_ADD_EXECUTABLE(pcl_openni_mobile_server "${SUBSYS_NAME}" src/openni_mobile_server.cpp) - target_link_libraries(pcl_openni_mobile_server pcl_common pcl_io pcl_filters pcl_visualization) + if(WITH_OPENNI) + PCL_ADD_EXECUTABLE(pcl_openni_fast_mesh COMPONENT ${SUBSYS_NAME} SOURCES src/openni_fast_mesh.cpp BUNDLE) + target_link_libraries(pcl_openni_fast_mesh pcl_common pcl_io pcl_visualization pcl_surface) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_planar_segmentation "${SUBSYS_NAME}" src/openni_planar_segmentation.cpp) - target_link_libraries(pcl_openni_planar_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus) + PCL_ADD_EXECUTABLE(pcl_openni_voxel_grid COMPONENT ${SUBSYS_NAME} SOURCES src/openni_voxel_grid.cpp BUNDLE) + target_link_libraries(pcl_openni_voxel_grid pcl_common pcl_io pcl_filters pcl_visualization) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_organized_multi_plane_segmentation "${SUBSYS_NAME}" src/openni_organized_multi_plane_segmentation.cpp) - target_link_libraries(pcl_openni_organized_multi_plane_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features) + PCL_ADD_EXECUTABLE(pcl_openni_octree_compression COMPONENT ${SUBSYS_NAME} SOURCES src/openni_octree_compression.cpp BUNDLE) + target_link_libraries(pcl_openni_octree_compression pcl_common pcl_io pcl_filters pcl_visualization pcl_octree) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_ii_normal_estimation "${SUBSYS_NAME}" src/openni_ii_normal_estimation.cpp) - target_link_libraries(pcl_openni_ii_normal_estimation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) + if(HAVE_PNG) + PCL_ADD_EXECUTABLE(pcl_openni_organized_compression COMPONENT ${SUBSYS_NAME} SOURCES src/openni_organized_compression.cpp BUNDLE) + target_link_libraries(pcl_openni_organized_compression pcl_common pcl_io pcl_filters pcl_visualization pcl_octree) + endif() - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_feature_persistence "${SUBSYS_NAME}" src/openni_feature_persistence.cpp) - target_link_libraries(pcl_openni_feature_persistence pcl_common pcl_io pcl_filters pcl_visualization pcl_features) + PCL_ADD_EXECUTABLE(pcl_openni_shift_to_depth_conversion COMPONENT ${SUBSYS_NAME} SOURCES src/openni_shift_to_depth_conversion.cpp BUNDLE) + target_link_libraries(pcl_openni_shift_to_depth_conversion pcl_common pcl_visualization) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_mls_smoothing "${SUBSYS_NAME}" src/openni_mls_smoothing.cpp) - target_link_libraries(pcl_openni_mls_smoothing pcl_common pcl_io pcl_surface pcl_visualization) + PCL_ADD_EXECUTABLE(pcl_openni_mobile_server COMPONENT ${SUBSYS_NAME} SOURCES src/openni_mobile_server.cpp) + target_link_libraries(pcl_openni_mobile_server pcl_common pcl_io pcl_filters pcl_visualization) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_change_viewer "${SUBSYS_NAME}" src/openni_change_viewer.cpp) - target_link_libraries(pcl_openni_change_viewer pcl_common pcl_io pcl_kdtree pcl_octree pcl_visualization pcl_filters) + PCL_ADD_EXECUTABLE(pcl_openni_planar_segmentation COMPONENT ${SUBSYS_NAME} SOURCES src/openni_planar_segmentation.cpp BUNDLE) + target_link_libraries(pcl_openni_planar_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_uniform_sampling "${SUBSYS_NAME}" src/openni_uniform_sampling.cpp) - target_link_libraries(pcl_openni_uniform_sampling pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface pcl_keypoints) + PCL_ADD_EXECUTABLE(pcl_openni_organized_multi_plane_segmentation COMPONENT ${SUBSYS_NAME} SOURCES src/openni_organized_multi_plane_segmentation.cpp BUNDLE) + target_link_libraries(pcl_openni_organized_multi_plane_segmentation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_features) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_boundary_estimation "${SUBSYS_NAME}" src/openni_boundary_estimation.cpp) - target_link_libraries(pcl_openni_boundary_estimation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) + PCL_ADD_EXECUTABLE(pcl_openni_ii_normal_estimation COMPONENT ${SUBSYS_NAME} SOURCES src/openni_ii_normal_estimation.cpp BUNDLE) + target_link_libraries(pcl_openni_ii_normal_estimation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_organized_edge_detection "${SUBSYS_NAME}" src/openni_organized_edge_detection.cpp) - target_link_libraries(pcl_openni_organized_edge_detection pcl_common pcl_io pcl_features pcl_visualization) + PCL_ADD_EXECUTABLE(pcl_openni_feature_persistence COMPONENT ${SUBSYS_NAME} SOURCES src/openni_feature_persistence.cpp BUNDLE) + target_link_libraries(pcl_openni_feature_persistence pcl_common pcl_io pcl_filters pcl_visualization pcl_features) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_face_detector "${SUBSYS_NAME}" src/face_detection//openni_face_detection.cpp src/face_detection//openni_frame_source.cpp) - target_link_libraries(pcl_openni_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) + PCL_ADD_EXECUTABLE(pcl_openni_mls_smoothing COMPONENT ${SUBSYS_NAME} SOURCES src/openni_mls_smoothing.cpp BUNDLE) + target_link_libraries(pcl_openni_mls_smoothing pcl_common pcl_io pcl_surface pcl_visualization) - if (QT4_FOUND AND VTK_USE_QVTK) - # OpenNI Passthrough application demo - QT4_WRAP_UI(openni_passthrough_ui src/openni_passthrough.ui) - QT4_WRAP_CPP(openni_passthrough_moc include/pcl/apps/openni_passthrough.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - PCL_ADD_EXECUTABLE(pcl_openni_passthrough "${SUBSYS_NAME}" ${openni_passthrough_ui} ${openni_passthrough_moc} src/openni_passthrough.cpp) - target_link_libraries(pcl_openni_passthrough pcl_common pcl_io pcl_filters pcl_visualization ${QVTK_LIBRARY} ${QT_LIBRARIES}) + PCL_ADD_EXECUTABLE(pcl_openni_change_viewer COMPONENT ${SUBSYS_NAME} SOURCES src/openni_change_viewer.cpp BUNDLE) + target_link_libraries(pcl_openni_change_viewer pcl_common pcl_io pcl_kdtree pcl_octree pcl_visualization pcl_filters) - # OpenNI Organized Connected Component application demo - QT4_WRAP_UI(organized_segmentation_demo_ui src/organized_segmentation_demo.ui) - QT4_WRAP_CPP(organized_segmentation_demo_moc include/pcl/apps/organized_segmentation_demo.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_organized_segmentation_demo "${SUBSYS_NAME}" ${organized_segmentation_demo_ui} ${organized_segmentation_demo_moc} src/organized_segmentation_demo.cpp) - target_link_libraries(pcl_organized_segmentation_demo pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) + PCL_ADD_EXECUTABLE(pcl_openni_uniform_sampling COMPONENT ${SUBSYS_NAME} SOURCES src/openni_uniform_sampling.cpp BUNDLE) + target_link_libraries(pcl_openni_uniform_sampling pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface pcl_keypoints) - # Database processing (integration) demo -# QT4_WRAP_UI(db_proc_ui src/db_proc/db_proc.ui) -# QT4_WRAP_CPP(db_proc_moc include/pcl/apps/db_proc.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) -# PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_db_proc "${SUBSYS_NAME}" ${db_proc_ui} ${db_proc_moc} src/db_proc/db_proc.cpp) -# target_link_libraries(pcl_db_proc pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface ${QVTK_LIBRARY} ${QT_LIBRARIES}) + PCL_ADD_EXECUTABLE(pcl_openni_boundary_estimation COMPONENT ${SUBSYS_NAME} SOURCES src/openni_boundary_estimation.cpp BUNDLE) + target_link_libraries(pcl_openni_boundary_estimation pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) - endif () + PCL_ADD_EXECUTABLE(pcl_openni_organized_edge_detection COMPONENT ${SUBSYS_NAME} SOURCES src/openni_organized_edge_detection.cpp BUNDLE) + target_link_libraries(pcl_openni_organized_edge_detection pcl_common pcl_io pcl_features pcl_visualization) - if (QHULL_FOUND) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_3d_convex_hull "${SUBSYS_NAME}" src/openni_3d_convex_hull.cpp) - target_link_libraries(pcl_openni_3d_convex_hull pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) + PCL_ADD_EXECUTABLE(pcl_openni_face_detector COMPONENT ${SUBSYS_NAME} SOURCES src/face_detection//openni_face_detection.cpp src/face_detection//openni_frame_source.cpp BUNDLE) + target_link_libraries(pcl_openni_face_detector pcl_features pcl_recognition pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface pcl_keypoints pcl_ml pcl_search pcl_kdtree ${VTK_LIBRARIES}) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_3d_concave_hull "${SUBSYS_NAME}" src/openni_3d_concave_hull.cpp) - target_link_libraries(pcl_openni_3d_concave_hull pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) + if(Qt5_FOUND AND QVTK_FOUND) + # OpenNI Passthrough application demo + QT5_WRAP_UI(openni_passthrough_ui src/openni_passthrough.ui) + QT5_WRAP_CPP(openni_passthrough_moc include/pcl/apps/openni_passthrough.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + PCL_ADD_EXECUTABLE(pcl_openni_passthrough COMPONENT ${SUBSYS_NAME} SOURCES ${openni_passthrough_ui} ${openni_passthrough_moc} src/openni_passthrough.cpp) + target_link_libraries(pcl_openni_passthrough pcl_common pcl_io pcl_filters pcl_visualization Qt5::Widgets) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_tracking "${SUBSYS_NAME}" src/openni_tracking.cpp) - target_link_libraries(pcl_openni_tracking pcl_common pcl_io pcl_surface pcl_visualization pcl_filters pcl_features pcl_segmentation pcl_tracking pcl_search) + # OpenNI Organized Connected Component application demo + QT5_WRAP_UI(organized_segmentation_demo_ui src/organized_segmentation_demo.ui) + QT5_WRAP_CPP(organized_segmentation_demo_moc include/pcl/apps/organized_segmentation_demo.h OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + PCL_ADD_EXECUTABLE(pcl_organized_segmentation_demo COMPONENT ${SUBSYS_NAME} SOURCES ${organized_segmentation_demo_ui} ${organized_segmentation_demo_moc} src/organized_segmentation_demo.cpp BUNDLE) + target_link_libraries(pcl_organized_segmentation_demo pcl_common pcl_io pcl_visualization pcl_segmentation pcl_features pcl_surface Qt5::Widgets) + endif() - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_planar_convex_hull "${SUBSYS_NAME}" src/openni_planar_convex_hull.cpp) - target_link_libraries(pcl_openni_planar_convex_hull pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface) + if(QHULL_FOUND) + PCL_ADD_EXECUTABLE(pcl_openni_3d_convex_hull COMPONENT ${SUBSYS_NAME} SOURCES src/openni_3d_convex_hull.cpp BUNDLE) + target_link_libraries(pcl_openni_3d_convex_hull pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_ni_linemod "${SUBSYS_NAME}" src/ni_linemod.cpp) - target_link_libraries(pcl_ni_linemod pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface pcl_search) + PCL_ADD_EXECUTABLE(pcl_openni_3d_concave_hull COMPONENT ${SUBSYS_NAME} SOURCES src/openni_3d_concave_hull.cpp BUNDLE) + target_link_libraries(pcl_openni_3d_concave_hull pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface) - endif() # QHULL_FOUND + PCL_ADD_EXECUTABLE(pcl_openni_tracking COMPONENT ${SUBSYS_NAME} SOURCES src/openni_tracking.cpp BUNDLE) + target_link_libraries(pcl_openni_tracking pcl_common pcl_io pcl_surface pcl_visualization pcl_filters pcl_features pcl_segmentation pcl_tracking pcl_search) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_ni_agast "${SUBSYS_NAME}" src/ni_agast.cpp) - target_link_libraries(pcl_ni_agast pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_keypoints pcl_surface pcl_search) + PCL_ADD_EXECUTABLE(pcl_openni_planar_convex_hull COMPONENT ${SUBSYS_NAME} SOURCES src/openni_planar_convex_hull.cpp BUNDLE) + target_link_libraries(pcl_openni_planar_convex_hull pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_surface) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_ni_brisk "${SUBSYS_NAME}" src/ni_brisk.cpp) - target_link_libraries(pcl_ni_brisk pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_keypoints pcl_surface pcl_search) + PCL_ADD_EXECUTABLE(pcl_ni_linemod COMPONENT ${SUBSYS_NAME} SOURCES src/ni_linemod.cpp BUNDLE) + target_link_libraries(pcl_ni_linemod pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_surface pcl_search) + endif() # QHULL_FOUND - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_ni_susan "${SUBSYS_NAME}" src/ni_susan.cpp) - target_link_libraries(pcl_ni_susan pcl_common pcl_visualization pcl_features pcl_keypoints pcl_search) + PCL_ADD_EXECUTABLE(pcl_ni_agast COMPONENT ${SUBSYS_NAME} SOURCES src/ni_agast.cpp BUNDLE) + target_link_libraries(pcl_ni_agast pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_keypoints pcl_surface pcl_search) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_ni_trajkovic ${SUBSYS_NAME} src/ni_trajkovic.cpp) - target_link_libraries(pcl_ni_trajkovic pcl_common pcl_visualization pcl_features pcl_keypoints pcl_search) + PCL_ADD_EXECUTABLE(pcl_ni_brisk COMPONENT ${SUBSYS_NAME} SOURCES src/ni_brisk.cpp BUNDLE) + target_link_libraries(pcl_ni_brisk pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_sample_consensus pcl_features pcl_keypoints pcl_surface pcl_search) - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_openni_klt "${SUBSYS_NAME}" src/openni_klt.cpp) - target_link_libraries(pcl_openni_klt pcl_common pcl_io pcl_visualization pcl_tracking) - endif() # WITH_OPENNI + PCL_ADD_EXECUTABLE(pcl_ni_susan COMPONENT ${SUBSYS_NAME} SOURCES src/ni_susan.cpp BUNDLE) + target_link_libraries(pcl_ni_susan pcl_common pcl_visualization pcl_features pcl_keypoints pcl_search) - endif() # VTK_FOUND + PCL_ADD_EXECUTABLE(pcl_ni_trajkovic COMPONENT ${SUBSYS_NAME} SOURCES src/ni_trajkovic.cpp BUNDLE) + target_link_libraries(pcl_ni_trajkovic pcl_common pcl_visualization pcl_features pcl_keypoints pcl_search) - # OpenGL and GLUT - if(OPENGL_FOUND AND GLUT_FOUND) - if(NOT WIN32) - include_directories("${OPENGL_INCLUDE_DIR}") - endif() - include_directories("${GLUT_INCLUDE_DIR}") - PCL_ADD_EXECUTABLE_OPT_BUNDLE(pcl_grabcut_2d "${SUBSYS_NAME}" src/grabcut_2d.cpp) - target_link_libraries (pcl_grabcut_2d pcl_common pcl_io pcl_segmentation pcl_search ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES}) - endif(OPENGL_FOUND AND GLUT_FOUND) - - collect_subproject_directory_names("${CMAKE_CURRENT_SOURCE_DIR}" "CMakeLists.txt" PCL_APPS_MODULES_NAMES PCL_APPS_MODULES_DIRS ${SUBSYS_NAME}) - set(PCL_APPS_MODULES_NAMES_UNSORTED ${PCL_APPS_MODULES_NAMES}) - topological_sort(PCL_APPS_MODULES_NAMES PCL_APPS_ _DEPENDS) - sort_relative(PCL_APPS_MODULES_NAMES_UNSORTED PCL_APPS_MODULES_NAMES PCL_APPS_MODULES_DIRS) - foreach(subdir ${PCL_APPS_MODULES_DIRS}) - add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${subdir}") - endforeach(subdir) + PCL_ADD_EXECUTABLE(pcl_openni_klt COMPONENT ${SUBSYS_NAME} SOURCES src/openni_klt.cpp BUNDLE) + target_link_libraries(pcl_openni_klt pcl_common pcl_io pcl_visualization pcl_tracking) + endif() # WITH_OPENNI +endif() # VTK_FOUND - if(QHULL_FOUND) - set(incs - "include/pcl/${SUBSYS_NAME}/dominant_plane_segmentation.h" - "include/pcl/${SUBSYS_NAME}/timer.h" - ${incs} - ) - set(impl_incs "include/pcl/${SUBSYS_NAME}/impl/dominant_plane_segmentation.hpp") - set(srcs "src/dominant_plane_segmentation.cpp" ${srcs}) +# OpenGL and GLUT +if(OPENGL_FOUND AND GLUT_FOUND) + if(NOT WIN32) + include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}") endif() - - set(LIB_NAME "pcl_${SUBSYS_NAME}") - PCL_ADD_LIBRARY("${LIB_NAME}" "${SUBSYS_NAME}" ${srcs} ${impl_incs} ${incs}) - target_link_libraries("${LIB_NAME}" pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search) - PCL_MAKE_PKGCONFIG("${LIB_NAME}" "${SUBSYS_NAME}" "${SUBSYS_DESC}" "" "" "" "" "") - # Install include files - PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}" ${incs}) - PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/impl" ${impl_incs}) - -endif(build) + PCL_ADD_EXECUTABLE(pcl_grabcut_2d COMPONENT ${SUBSYS_NAME} SOURCES src/grabcut_2d.cpp BUNDLE) + target_link_libraries (pcl_grabcut_2d pcl_common pcl_io pcl_segmentation pcl_search GLUT::GLUT ${OPENGL_LIBRARIES}) +endif() + +collect_subproject_directory_names("${CMAKE_CURRENT_SOURCE_DIR}" "CMakeLists.txt" PCL_APPS_MODULES_NAMES PCL_APPS_MODULES_DIRS ${SUBSYS_NAME}) +set(PCL_APPS_MODULES_NAMES_UNSORTED ${PCL_APPS_MODULES_NAMES}) +topological_sort(PCL_APPS_MODULES_NAMES PCL_APPS_ _DEPENDS) +sort_relative(PCL_APPS_MODULES_NAMES_UNSORTED PCL_APPS_MODULES_NAMES PCL_APPS_MODULES_DIRS) +foreach(subdir ${PCL_APPS_MODULES_DIRS}) +add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/${subdir}") +endforeach() + +if(QHULL_FOUND) + set(incs + "include/pcl/${SUBSYS_NAME}/dominant_plane_segmentation.h" + "include/pcl/${SUBSYS_NAME}/timer.h" + ${incs} + ) + set(impl_incs "include/pcl/${SUBSYS_NAME}/impl/dominant_plane_segmentation.hpp") + set(srcs "src/dominant_plane_segmentation.cpp" ${srcs}) +endif() + +set(LIB_NAME "pcl_${SUBSYS_NAME}") +PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} SOURCES ${srcs} ${impl_incs} ${incs}) +target_link_libraries("${LIB_NAME}" pcl_common pcl_io pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search) +PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC}) +# Install include files +PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}" ${incs}) +PCL_ADD_INCLUDES("${SUBSYS_NAME}" "${SUBSYS_NAME}/impl" ${impl_incs}) + +if(CMAKE_GENERATOR_IS_IDE) + set(SUBSYS_TARGET_NAME APPS_BUILD) +else() + set(SUBSYS_TARGET_NAME ${SUBSYS_NAME}) +endif() +add_custom_target(${SUBSYS_TARGET_NAME} DEPENDS ${PCL_APPS_ALL_TARGETS}) +set_target_properties(${SUBSYS_TARGET_NAME} PROPERTIES FOLDER "Apps") diff --git a/apps/cloud_composer/CMakeLists.txt b/apps/cloud_composer/CMakeLists.txt index d4449752..d70e4bb5 100644 --- a/apps/cloud_composer/CMakeLists.txt +++ b/apps/cloud_composer/CMakeLists.txt @@ -1,198 +1,212 @@ #Disable some warnings which are all over Qt headers and make finding error messages hell -#if(${CMAKE_CXX_FLAGS} MATCHES "-Wconversion") -# string(REGEX REPLACE "-Wconversion(.+)" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +#if(${CMAKE_CXX_FLAGS} MATCHES "-Wconversion") +# string(REGEX REPLACE "-Wconversion(.+)" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") #endif() -SET(SUBSUBSYS_NAME cloud_composer) -SET(SUBSUBSYS_DESC "Cloud Composer - Application for Manipulating Point Clouds") -SET(SUBSUBSYS_DEPS common io visualization filters apps) +set(SUBSUBSYS_NAME cloud_composer) +set(SUBSUBSYS_DESC "Cloud Composer - Application for Manipulating Point Clouds") +set(SUBSUBSYS_DEPS common io visualization filters apps) -# Find VTK +# Find VTK if(NOT VTK_FOUND) set(DEFAULT AUTO_OFF) set(REASON "VTK was not found.") -else(NOT VTK_FOUND) +else() set(DEFAULT TRUE) set(REASON) include("${VTK_USE_FILE}") -endif(NOT VTK_FOUND) +endif() -# QT4 Found? -if(NOT QT4_FOUND) +# QT5 Found? +if(NOT Qt5_FOUND) set(DEFAULT AUTO_OFF) - set(REASON "Qt4 was not found.") + set(REASON "Qt5 was not found.") elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") set(DEFAULT TRUE) set(REASON) -endif(NOT QT4_FOUND) +endif() # QVTK? -if(NOT VTK_USE_QVTK) +if(NOT QVTK_FOUND) set(DEFAULT AUTO_OFF) set(REASON "Cloud composer requires QVTK") elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") set(DEFAULT TRUE) set(REASON) -endif(NOT VTK_USE_QVTK) +endif() #Default to not building for now -if ("${DEFAULT}" STREQUAL "TRUE") +if("${DEFAULT}" STREQUAL "TRUE") set(DEFAULT FALSE) -endif ("${DEFAULT}" STREQUAL "TRUE") +endif() PCL_SUBSUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" ${DEFAULT} "${REASON}") PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSUBSYS_DEPS}) PCL_ADD_DOC(${SUBSUBSYS_NAME}) -if(build) - - include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") - - #Sources & Headers for main application - set(incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/qt.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_composer.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/project_model.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_viewer.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_view.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_browser.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/item_inspector.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tool_interface/abstract_tool.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tool_interface/tool_factory.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/commands.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/work_queue.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/toolbox_model.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/properties_model.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/signal_multiplexer.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/merge_selection.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/transform_clouds.h") - - set(srcs src/main.cpp - src/cloud_composer.cpp - src/project_model.cpp - src/cloud_viewer.cpp - src/cloud_view.cpp - src/item_inspector.cpp - src/cloud_browser.cpp - src/commands.cpp - src/work_queue.cpp - src/toolbox_model.cpp - src/properties_model.cpp - src/signal_multiplexer.cpp - src/merge_selection.cpp - src/tool_interface/abstract_tool.cpp - src/transform_clouds.cpp) - - set(impl_incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/cloud_item.hpp" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/merge_selection.hpp" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/transform_clouds.hpp") - - #Sources and headers for item types - set(item_incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/cloud_composer_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/cloud_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/normals_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/fpfh_item.h") - - set(item_srcs src/items/cloud_composer_item.cpp - src/items/cloud_item.cpp - src/items/normals_item.cpp - src/items/fpfh_item.cpp) - - #Sources and headers for point selectors - set (selector_incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/interactor_style_switch.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/rectangular_frustum_selector.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/selected_trackball_interactor_style.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/click_trackball_interactor_style.h") - - set (selector_srcs src/point_selectors/interactor_style_switch.cpp - src/point_selectors/selection_event.cpp - src/point_selectors/rectangular_frustum_selector.cpp - src/point_selectors/selected_trackball_interactor_style.cpp - src/point_selectors/click_trackball_interactor_style.cpp - src/point_selectors/manipulation_event.cpp) - - set(uis src/cloud_composer_main_window.ui) - set(resources resources/resources.qrc) - - QT4_WRAP_UI(cloud_composer_ui ${uis}) - QT4_WRAP_CPP(cloud_composer_moc ${incs} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - QT4_ADD_RESOURCES(resource_srcs ${resources}) - - set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") - PCL_ADD_EXECUTABLE("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${cloud_composer_ui} ${cloud_composer_moc} ${srcs} ${resource_srcs} ${item_srcs} ${selector_srcs} ${impl_incs}) - target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_visualization pcl_filters ${QVTK_LIBRARY} ${QT_LIBRARIES}) - - # Install include files - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${incs} ${item_incs} ${selector_incs}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${impl_incs}) - - PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSYS_DESC}" "" "" "" "" "") - - - #TOOL buildING SCRIPTS - #Create subdirectory for plugin libs - set (CLOUD_COMPOSER_PLUGIN_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cloud_composer_plugins") - make_directory("${CLOUD_COMPOSER_PLUGIN_DIR}") - - set(INTERFACE_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tool_interface/abstract_tool.h") - set(INTERFACE_SOURCES src/tool_interface/abstract_tool.cpp) - - QT4_WRAP_CPP(INTERFACE_HEADERS_MOC ${INTERFACE_HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - PCL_ADD_LIBRARY(pcl_cc_tool_interface "${SUBSUBSYS_NAME}" ${INTERFACE_SOURCES} ${INTERFACE_HEADERS_MOC}) - target_link_libraries(pcl_cc_tool_interface pcl_common ${QT_LIBRARIES}) - - IF(APPLE) - SET_TARGET_PROPERTIES(pcl_cc_tool_interface PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - ENDIF() - - include(ComposerTool.cmake REQUIRED) - - #FPFH Tool - set (FPFH_DEPS pcl_features pcl_kdtree pcl_filters) - set (FPFH_SOURCES tools/fpfh_estimation.cpp) - set (FPFH_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/fpfh_estimation.h") - define_composer_tool (fpfh_estimation "${FPFH_SOURCES}" "${FPFH_HEADERS}" "${FPFH_DEPS}") - - #Normals Tool - set (NORMALS_DEPS pcl_features pcl_kdtree) - set (NORMALS_SOURCES tools/normal_estimation.cpp) - set (NORMALS_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/normal_estimation.h") - define_composer_tool (normal_estimation "${NORMALS_SOURCES}" "${NORMALS_HEADERS}" "${NORMALS_DEPS}") - - #Euclidean Clustering Tool - set (EC_DEPS pcl_segmentation pcl_kdtree) - set (EC_SOURCES tools/euclidean_clustering.cpp) - set (EC_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/euclidean_clustering.h") - define_composer_tool (euclidean_clustering "${EC_SOURCES}" "${EC_HEADERS}" "${EC_DEPS}") - - #Statistical Outlier Removal Tool - set (SOR_DEPS pcl_filters) - set (SOR_SOURCES tools/statistical_outlier_removal.cpp) - set (SOR_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/statistical_outlier_removal.h") - define_composer_tool (statistical_outlier_removal "${SOR_SOURCES}" "${SOR_HEADERS}" "${SOR_DEPS}") - - #Vox Grid Downsample Tool - set (VOXDS_DEPS pcl_filters) - set (VOXDS_SOURCES tools/voxel_grid_downsample.cpp) - set (VOXDS_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/voxel_grid_downsample.h") - define_composer_tool (voxel_grid_downsample "${VOXDS_SOURCES}" "${VOXDS_HEADERS}" "${VOXDS_DEPS}") - - #Organized Segmentation - set (OSEG_DEPS pcl_segmentation pcl_kdtree) - set (OSEG_SOURCES tools/organized_segmentation.cpp "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/impl/organized_segmentation.hpp") - set (OSEG_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/organized_segmentation.h") - define_composer_tool (organized_segmentation "${OSEG_SOURCES}" "${OSEG_HEADERS}" "${OSEG_DEPS}") - - #Sanitize Cloud Tool - set (SAN_DEPS pcl_filters) - set (SAN_SOURCES tools/sanitize_cloud.cpp) - set (SAN_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/sanitize_cloud.h") - define_composer_tool (sanitize_cloud "${SAN_SOURCES}" "${SAN_HEADERS}" "${SAN_DEPS}") - - #Supervoxels - set (VSP_DEPS pcl_octree pcl_segmentation) - set (VSP_SOURCES tools/supervoxels.cpp "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/impl/supervoxels.hpp") - set (VSP_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/supervoxels.h") - define_composer_tool (supervoxels "${VSP_SOURCES}" "${VSP_HEADERS}" "${VSP_DEPS}") - -endif(build) +if(NOT build) + return() +endif() + +include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") + +#Create subdirectory for plugin libs +set(CLOUD_COMPOSER_PLUGIN_DIR "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cloud_composer_plugins") +make_directory("${CLOUD_COMPOSER_PLUGIN_DIR}") + +set(INTERFACE_HEADERS + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/commands.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/properties_model.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/cloud_composer_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/cloud_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/fpfh_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/items/normals_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/click_trackball_interactor_style.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/interactor_style_switch.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/manipulation_event.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/rectangular_frustum_selector.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/selected_trackball_interactor_style.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/point_selectors/selection_event.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tool_interface/abstract_tool.h" +) + +set(INTERFACE_SOURCES + src/commands.cpp + src/properties_model.cpp + src/items/cloud_composer_item.cpp + src/items/cloud_item.cpp + src/items/fpfh_item.cpp + src/items/normals_item.cpp + src/point_selectors/click_trackball_interactor_style.cpp + src/point_selectors/interactor_style_switch.cpp + src/point_selectors/manipulation_event.cpp + src/point_selectors/rectangular_frustum_selector.cpp + src/point_selectors/selected_trackball_interactor_style.cpp + src/point_selectors/selection_event.cpp + src/tool_interface/abstract_tool.cpp +) + +# Build pcl_cc_tool_interface as static library, to fix issue mentioned in #2708 +set(PCL_LIB_TYPE_ORIGIN ${PCL_LIB_TYPE}) +set(PCL_LIB_TYPE STATIC) +QT5_WRAP_CPP(INTERFACE_HEADERS_MOC ${INTERFACE_HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +PCL_ADD_LIBRARY(pcl_cc_tool_interface COMPONENT ${SUBSUBSYS_NAME} SOURCES ${INTERFACE_HEADERS} ${INTERFACE_SOURCES} ${INTERFACE_HEADERS_MOC}) +target_link_libraries(pcl_cc_tool_interface pcl_common pcl_filters pcl_search pcl_visualization ${VTK_LIBRARIES} Qt5::Widgets) +set(PCL_LIB_TYPE ${PCL_LIB_TYPE_ORIGIN}) + +if(APPLE) + set_target_properties(pcl_cc_tool_interface PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") +endif() + +#Sources & Headers for main application +set(incs + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_browser.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_composer.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_view.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_viewer.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/item_inspector.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/merge_selection.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/project_model.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/properties_model.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/signal_multiplexer.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/toolbox_model.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/transform_clouds.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/work_queue.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tool_interface/tool_factory.h" +) + +set(srcs + src/cloud_browser.cpp + src/cloud_composer.cpp + src/cloud_view.cpp + src/cloud_viewer.cpp + src/item_inspector.cpp + src/main.cpp + src/merge_selection.cpp + src/project_model.cpp + src/properties_model.cpp + src/signal_multiplexer.cpp + src/toolbox_model.cpp + src/transform_clouds.cpp + src/work_queue.cpp +) + +set(impl_incs + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/cloud_item.hpp" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/merge_selection.hpp" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/transform_clouds.hpp" +) + +set(uis src/cloud_composer_main_window.ui) +set(resources resources/resources.qrc) + +QT5_WRAP_UI(cloud_composer_ui ${uis}) +QT5_WRAP_CPP(cloud_composer_moc ${incs} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +QT5_ADD_RESOURCES(resource_srcs ${resources}) + +set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") +PCL_ADD_EXECUTABLE(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} SOURCES ${cloud_composer_ui} ${cloud_composer_moc} ${srcs} ${resource_srcs} ${impl_incs}) +target_link_libraries("${EXE_NAME}" pcl_cc_tool_interface pcl_common pcl_io pcl_visualization pcl_filters Qt5::Widgets) + +# Install include files +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${incs} ${item_incs} ${selector_incs}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${impl_incs}) + +PCL_MAKE_PKGCONFIG(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} DESC ${SUBSYS_DESC}) + + +#TOOL buildING SCRIPTS +include(ComposerTool.cmake REQUIRED) + +#FPFH Tool +set(FPFH_DEPS pcl_features pcl_kdtree pcl_filters) +set(FPFH_SOURCES tools/fpfh_estimation.cpp) +set(FPFH_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/fpfh_estimation.h") +define_composer_tool (fpfh_estimation "${FPFH_SOURCES}" "${FPFH_HEADERS}" "${FPFH_DEPS}") + +#Normals Tool +set(NORMALS_DEPS pcl_features pcl_kdtree) +set(NORMALS_SOURCES tools/normal_estimation.cpp) +set(NORMALS_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/normal_estimation.h") +define_composer_tool (normal_estimation "${NORMALS_SOURCES}" "${NORMALS_HEADERS}" "${NORMALS_DEPS}") + +#Euclidean Clustering Tool +set(EC_DEPS pcl_segmentation pcl_kdtree) +set(EC_SOURCES tools/euclidean_clustering.cpp) +set(EC_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/euclidean_clustering.h") +define_composer_tool (euclidean_clustering "${EC_SOURCES}" "${EC_HEADERS}" "${EC_DEPS}") + +#Statistical Outlier Removal Tool +set(SOR_DEPS pcl_filters) +set(SOR_SOURCES tools/statistical_outlier_removal.cpp) +set(SOR_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/statistical_outlier_removal.h") +define_composer_tool (statistical_outlier_removal "${SOR_SOURCES}" "${SOR_HEADERS}" "${SOR_DEPS}") + +#Vox Grid Downsample Tool +set(VOXDS_DEPS pcl_filters) +set(VOXDS_SOURCES tools/voxel_grid_downsample.cpp) +set(VOXDS_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/voxel_grid_downsample.h") +define_composer_tool (voxel_grid_downsample "${VOXDS_SOURCES}" "${VOXDS_HEADERS}" "${VOXDS_DEPS}") + +#Organized Segmentation +set(OSEG_DEPS pcl_segmentation pcl_kdtree) +set(OSEG_SOURCES tools/organized_segmentation.cpp "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/impl/organized_segmentation.hpp") +set(OSEG_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/organized_segmentation.h") +define_composer_tool (organized_segmentation "${OSEG_SOURCES}" "${OSEG_HEADERS}" "${OSEG_DEPS}") + +#Sanitize Cloud Tool +set(SAN_DEPS pcl_filters) +set(SAN_SOURCES tools/sanitize_cloud.cpp) +set(SAN_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/sanitize_cloud.h") +define_composer_tool (sanitize_cloud "${SAN_SOURCES}" "${SAN_HEADERS}" "${SAN_DEPS}") + +#Supervoxels +set(VSP_DEPS pcl_octree pcl_segmentation) +set(VSP_SOURCES tools/supervoxels.cpp "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/impl/supervoxels.hpp") +set(VSP_HEADERS "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/tools/supervoxels.h") +define_composer_tool (supervoxels "${VSP_SOURCES}" "${VSP_HEADERS}" "${VSP_DEPS}") + +# Add to the compound apps target +list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME}) +set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE) diff --git a/apps/cloud_composer/ComposerTool.cmake b/apps/cloud_composer/ComposerTool.cmake index ee37b627..6ba49c8d 100644 --- a/apps/cloud_composer/ComposerTool.cmake +++ b/apps/cloud_composer/ComposerTool.cmake @@ -1,29 +1,28 @@ # Template to make a tool function(define_composer_tool TOOL_NAME TOOL_SOURCES TOOL_HEADERS DEPS) - + project(pcl_cc_tool_${TOOL_NAME}) - #MESSAGE ("Making plugin " pcl_cc_tool_${TOOL_NAME}) - QT4_WRAP_CPP(TOOL_HEADERS_MOC ${TOOL_HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + #message("Making plugin " pcl_cc_tool_${TOOL_NAME}) + QT5_WRAP_CPP(TOOL_HEADERS_MOC ${TOOL_HEADERS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) set(TOOL_TARGET pcl_cc_tool_${TOOL_NAME}) - # MESSAGE ("Files:" ${TOOL_SOURCES} ${TOOL_HEADERS_MOC}) - PCL_ADD_LIBRARY(${TOOL_TARGET} ${SUBSYS_NAME} ${TOOL_SOURCES} ${TOOL_HEADERS} ${TOOL_HEADERS_MOC}) + # message("Files:" ${TOOL_SOURCES} ${TOOL_HEADERS_MOC}) + PCL_ADD_LIBRARY(${TOOL_TARGET} COMPONENT ${SUBSYS_NAME} SOURCES ${TOOL_SOURCES} ${TOOL_HEADERS} ${TOOL_HEADERS_MOC}) if(WIN32) set_target_properties (${TOOL_TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CLOUD_COMPOSER_PLUGIN_DIR} RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CLOUD_COMPOSER_PLUGIN_DIR}) - else(WIN32) + else() set_target_properties (${TOOL_TARGET} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CLOUD_COMPOSER_PLUGIN_DIR}) - endif(WIN32) - ADD_DEFINITIONS(${QT_DEFINITIONS}) - ADD_DEFINITIONS(-DQT_PLUGIN) - ADD_DEFINITIONS(-DQT_NO_DEBUG) - ADD_DEFINITIONS(-DQT_SHARED) - - add_dependencies(${TOOL_TARGET} pcl_cc_tool_interface ${DEPS}) - target_link_libraries(${TOOL_TARGET} pcl_cc_tool_interface pcl_common pcl_io ${DEPS} ${QT_LIBRARIES}) + endif() + add_definitions(${QT_DEFINITIONS}) + add_definitions(-DQT_PLUGIN) + add_definitions(-DQT_NO_DEBUG) + add_definitions(-DQT_SHARED) + + target_link_libraries(${TOOL_TARGET} pcl_cc_tool_interface pcl_common pcl_io ${DEPS} Qt5::Widgets) + + if(APPLE) + set_target_properties(${TOOL_TARGET} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") + endif() - IF(APPLE) - SET_TARGET_PROPERTIES(${TOOL_TARGET} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - ENDIF() - -endfunction(define_composer_tool TOOL_NAME TOOL_SOURCES TOOL_HEADERS DEPS) +endfunction() diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_browser.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_browser.h index fcdf5124..c5e8c7d6 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_browser.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_browser.h @@ -35,10 +35,10 @@ * */ -#ifndef CLOUD_BROWSER_H_ -#define CLOUD_BROWSER_H_ +#pragma once -#include +#include +#include class QItemSelectionModel; @@ -55,10 +55,10 @@ namespace pcl { Q_OBJECT public: - CloudBrowser (QWidget* parent = 0); + CloudBrowser (QWidget* parent = nullptr); - virtual void - setModel (QAbstractItemModel* new_model); + void + setModel (QAbstractItemModel* new_model) override; private: ProjectModel* current_project_model_; @@ -69,31 +69,13 @@ namespace pcl { public: explicit - BackgroundDelegate (QObject *parent = 0) + BackgroundDelegate (QObject *parent = nullptr) : QStyledItemDelegate(parent) {} void - paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; + paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; }; } } - - - - - - - - - - - - - - - - - -#endif diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_composer.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_composer.h index a4d302b4..ec7e0be1 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_composer.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_composer.h @@ -35,10 +35,7 @@ * */ -#ifndef CLOUD_COMPOSER_H_ -#define CLOUD_COMPOSER_H_ - -#include +#pragma once //PCL #include @@ -73,7 +70,7 @@ namespace pcl { Q_OBJECT public: - explicit ComposerMainWindow (QWidget *parent = 0); + explicit ComposerMainWindow (QWidget *parent = nullptr); ~ComposerMainWindow (); Q_SIGNALS: @@ -169,8 +166,3 @@ namespace pcl } } - - - - -#endif // CLOUD_COMPOSER_H diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_view.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_view.h index 66f59950..19c91ca7 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_view.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_view.h @@ -35,13 +35,17 @@ * */ -#ifndef CLOUD_VIEW_H_ -#define CLOUD_VIEW_H_ +#pragma once + +#include + +#include -#include #include #include -#include + +class QItemSelection; +class QStandardItem; namespace pcl { @@ -57,10 +61,9 @@ namespace pcl Q_OBJECT public: - CloudView (QWidget* parent = 0); + CloudView (QWidget* parent = nullptr); CloudView (const CloudView& to_copy); - CloudView (ProjectModel* model, QWidget* parent = 0); - virtual ~CloudView (); + CloudView (ProjectModel* model, QWidget* parent = nullptr); void setModel (ProjectModel* new_model); @@ -70,7 +73,7 @@ namespace pcl QVTKWidget* getQVTK() const {return qvtk_; } - boost::shared_ptr + pcl::visualization::PCLVisualizer::Ptr getPCLVisualizer () const { return vis_; } void @@ -116,9 +119,9 @@ namespace pcl protected: void - paintEvent (QPaintEvent* event); + paintEvent (QPaintEvent* event) override; void - resizeEvent (QResizeEvent* event); + resizeEvent (QResizeEvent* event) override; // void scrollContentsBy (int dx, int dy); @@ -136,7 +139,7 @@ namespace pcl void removeOrientationMarkerWidgetAxes (); - boost::shared_ptr vis_; + pcl::visualization::PCLVisualizer::Ptr vis_; ProjectModel* model_; QVTKWidget* qvtk_; vtkSmartPointer style_switch_; @@ -151,5 +154,3 @@ namespace pcl } Q_DECLARE_METATYPE (pcl::cloud_composer::CloudView); -#endif - diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_viewer.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_viewer.h index 95d76209..62ebc4f2 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_viewer.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/cloud_viewer.h @@ -35,13 +35,13 @@ * */ -#ifndef CLOUD_VIEWER_H_ -#define CLOUD_VIEWER_H_ +#pragma once + +#include #include #include #include -#include namespace pcl { @@ -58,8 +58,8 @@ namespace pcl public: - CloudViewer (QWidget* parent = 0); - virtual ~CloudViewer(); + CloudViewer (QWidget* parent = nullptr); + ~CloudViewer(); ProjectModel* getModel () const; public Q_SLOTS: @@ -78,9 +78,8 @@ namespace pcl private: - boost::shared_ptr vis_; + pcl::visualization::PCLVisualizer::Ptr vis_; QMap model_view_map_; }; } } -#endif diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h index 0edc9124..5186af6a 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/commands.h @@ -35,13 +35,12 @@ * */ -#ifndef COMMANDS_H_ -#define COMMANDS_H_ +#pragma once -#include -#include #include +#include + namespace pcl { namespace cloud_composer @@ -56,22 +55,22 @@ namespace pcl - class PCL_EXPORTS CloudCommand : public QUndoCommand + class CloudCommand : public QUndoCommand { public: - CloudCommand (ConstItemList input_data, QUndoCommand* parent = 0); + CloudCommand (ConstItemList input_data, QUndoCommand* parent = nullptr); + - virtual ~CloudCommand (); virtual bool runCommand (AbstractTool* tool) = 0; - virtual void - undo () = 0; + void + undo () override = 0; - virtual void - redo () = 0; + void + redo () override = 0; //QList // executeToolOnTemplateCloud (AbstractTool* tool, ConstItemList &input_data); @@ -82,7 +81,7 @@ namespace pcl inline void setInputData (ConstItemList input_data) { - original_data_ = input_data; + original_data_ = std::move(input_data); } protected: /** \brief Removes the original item(s) from the model and replaces with the replacement(s) @@ -90,11 +89,11 @@ namespace pcl * This stores the removed items in removed_items_ */ bool - replaceOriginalWithNew (QList originals, QList new_items); + replaceOriginalWithNew (const QList & originals, const QList & new_items); /** \brief This removes new_items from the model and restores originals */ bool - restoreOriginalRemoveNew (QList originals, QList new_items); + restoreOriginalRemoveNew (const QList & originals, const QList & new_items); ConstItemList original_data_; @@ -119,95 +118,95 @@ namespace pcl int template_type_; }; - class PCL_EXPORTS ModifyItemCommand : public CloudCommand + class ModifyItemCommand : public CloudCommand { public: - ModifyItemCommand (ConstItemList input_data, QUndoCommand* parent = 0); + ModifyItemCommand (ConstItemList input_data, QUndoCommand* parent = nullptr); - virtual bool - runCommand (AbstractTool* tool); + bool + runCommand (AbstractTool* tool) override; - virtual void - undo (); + void + undo () override; - virtual void - redo (); + void + redo () override; private: }; - class PCL_EXPORTS NewItemCloudCommand : public CloudCommand + class NewItemCloudCommand : public CloudCommand { public: - NewItemCloudCommand (ConstItemList input_data, QUndoCommand* parent = 0); + NewItemCloudCommand (ConstItemList input_data, QUndoCommand* parent = nullptr); - virtual bool - runCommand (AbstractTool* tool); + bool + runCommand (AbstractTool* tool) override; - virtual void - undo (); + void + undo () override; - virtual void - redo (); + void + redo () override; }; - class PCL_EXPORTS SplitCloudCommand : public CloudCommand + class SplitCloudCommand : public CloudCommand { public: - SplitCloudCommand (ConstItemList input_data, QUndoCommand* parent = 0); + SplitCloudCommand (ConstItemList input_data, QUndoCommand* parent = nullptr); - virtual bool - runCommand (AbstractTool* tool); + bool + runCommand (AbstractTool* tool) override; - virtual void - undo (); + void + undo () override; - virtual void - redo (); + void + redo () override; private: }; - class PCL_EXPORTS DeleteItemCommand : public CloudCommand + class DeleteItemCommand : public CloudCommand { public: - DeleteItemCommand (ConstItemList input_data, QUndoCommand* parent = 0); + DeleteItemCommand (ConstItemList input_data, QUndoCommand* parent = nullptr); - virtual bool - runCommand (AbstractTool* tool); + bool + runCommand (AbstractTool* tool) override; - virtual void - undo (); + void + undo () override; - virtual void - redo (); + void + redo () override; private: }; - class PCL_EXPORTS MergeCloudCommand : public CloudCommand + class MergeCloudCommand : public CloudCommand { public: /** \brief Construct for a merge command * \param[in] input_data Input list of CloudItem s from the project model which will be merged * \param[in] temporary_clouds Input list of CloudItems which */ - MergeCloudCommand (ConstItemList input_data, QUndoCommand* parent = 0); + MergeCloudCommand (ConstItemList input_data, QUndoCommand* parent = nullptr); - virtual bool - runCommand (AbstractTool* tool); + bool + runCommand (AbstractTool* tool) override; - virtual void - undo (); + void + undo () override; - virtual void - redo (); + void + redo () override; inline void - setSelectedIndicesMap( const QMap selected_item_index_map) + setSelectedIndicesMap( const QMap & selected_item_index_map) { selected_item_index_map_ = selected_item_index_map; } @@ -219,4 +218,3 @@ namespace pcl } Q_DECLARE_METATYPE (ConstItemList); -#endif //COMMANDS_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp index 5c4e24a4..4af174bd 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/cloud_item.hpp @@ -45,7 +45,6 @@ template void pcl::cloud_composer::CloudItem::printNumPoints () const { - //boost::shared_ptr > cloud = this->data (ItemDataRole::CLOUD_TEMPLATED).value > > (); QVariant variant = this->data (ItemDataRole::CLOUD_TEMPLATED); typename PointCloud::Ptr cloud; if ( variant.canConvert ::Ptr> () ) @@ -65,7 +64,7 @@ pcl::cloud_composer::CloudItem::printNumPoints () const template pcl::cloud_composer::CloudItem* -pcl::cloud_composer::CloudItem::createCloudItemFromTemplate (const QString name, typename PointCloud::Ptr cloud_ptr) +pcl::cloud_composer::CloudItem::createCloudItemFromTemplate (const QString& name, typename PointCloud::Ptr cloud_ptr) { pcl::PCLPointCloud2::Ptr cloud_blob = boost::make_shared (); toPCLPointCloud2 (*cloud_ptr, *cloud_blob); @@ -76,8 +75,8 @@ pcl::cloud_composer::CloudItem::createCloudItemFromTemplate (const QString name, } -#define PCL_INSTANTIATE_createCloudItemFromTemplate(T) template PCL_EXPORTS pcl::cloud_composer::CloudItem* pcl::cloud_composer::CloudItem::createCloudItemFromTemplate(const QString, typename PointCloud::Ptr); +#define PCL_INSTANTIATE_createCloudItemFromTemplate(T) template pcl::cloud_composer::CloudItem* pcl::cloud_composer::CloudItem::createCloudItemFromTemplate(const QString, typename PointCloud::Ptr); -#define PCL_INSTANTIATE_printNumPoints(T) template PCL_EXPORTS void pcl::cloud_composer::CloudItem::getNumPoints(); +#define PCL_INSTANTIATE_printNumPoints(T) template void pcl::cloud_composer::CloudItem::getNumPoints(); -#endif \ No newline at end of file +#endif diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp index 8b3cbec1..9574b738 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/merge_selection.hpp @@ -43,7 +43,7 @@ #include template QList -pcl::cloud_composer::MergeSelection::performTemplatedAction (QList input_data) +pcl::cloud_composer::MergeSelection::performTemplatedAction (const QList & input_data) { QList output; @@ -67,7 +67,7 @@ pcl::cloud_composer::MergeSelection::performTemplatedAction (QList filter; - typename PointCloud::Ptr merged_cloud = boost::shared_ptr > (new PointCloud); + typename PointCloud::Ptr merged_cloud (new PointCloud); foreach (const CloudItem* input_cloud_item, selected_item_index_map_.keys ()) { @@ -79,11 +79,11 @@ pcl::cloud_composer::MergeSelection::performTemplatedAction (QList indices.size() << " points out of "<width; filter.setInputCloud (input_cloud); filter.setIndices (selected_item_index_map_.value (input_cloud_item)); - typename PointCloud::Ptr original_minus_indices = boost::shared_ptr > (new PointCloud); + typename PointCloud::Ptr original_minus_indices (new PointCloud); filter.setNegative (true); filter.filter (*original_minus_indices); filter.setNegative (false); - typename PointCloud::Ptr selected_points = boost::shared_ptr > (new PointCloud); + typename PointCloud::Ptr selected_points (new PointCloud); filter.filter (*selected_points); qDebug () << "Original minus indices is "<width; @@ -111,7 +111,7 @@ pcl::cloud_composer::MergeSelection::performTemplatedAction (QList (QList ); +#define PCL_INSTANTIATE_performTemplatedAction(T) template void pcl::cloud_composer::MergeSelection::performTemplatedAction (QList ); diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp index 98196d22..92574aec 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/impl/transform_clouds.hpp @@ -44,7 +44,7 @@ #include template QList -pcl::cloud_composer::TransformClouds::performTemplatedAction (QList input_data) +pcl::cloud_composer::TransformClouds::performTemplatedAction (const QList & input_data) { QList output; @@ -75,7 +75,7 @@ pcl::cloud_composer::TransformClouds::performTemplatedAction (QList getId ()), transform); - typename PointCloud::Ptr transformed_cloud = boost::shared_ptr > (new PointCloud); + typename PointCloud::Ptr transformed_cloud (new PointCloud); transformPointCloud (*input_cloud, *transformed_cloud, transform); CloudItem* new_cloud_item = CloudItem::createCloudItemFromTemplate(input_item->text (),transformed_cloud); @@ -91,7 +91,7 @@ pcl::cloud_composer::TransformClouds::performTemplatedAction (QList (QList ); +#define PCL_INSTANTIATE_performTemplatedAction(T) template void pcl::cloud_composer::TransformClouds::performTemplatedAction (QList ); diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/item_inspector.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/item_inspector.h index f4527474..befb2997 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/item_inspector.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/item_inspector.h @@ -35,13 +35,15 @@ * */ -#ifndef ITEM_INSPECTOR_H_ -#define ITEM_INSPECTOR_H_ +#pragma once + +#include -#include #include #include + class QItemSelectionModel; +class QTreeView; namespace pcl { @@ -55,8 +57,8 @@ namespace pcl { Q_OBJECT public: - ItemInspector (QWidget* parent = 0); - virtual ~ItemInspector(); + ItemInspector (QWidget* parent = nullptr); + ~ItemInspector(); public Q_SLOTS: void @@ -98,21 +100,3 @@ namespace pcl } } - - - - - - - - - - - - - - - - - -#endif diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h index f04303a3..7252b216 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_composer_item.h @@ -35,18 +35,12 @@ * */ -#ifndef CLOUD_COMPOSER_ITEM_H_ -#define CLOUD_COMPOSER_ITEM_H_ - +#pragma once #include #include -#include #include - - - static QStringList ITEM_TYPES_STRINGS(QStringList() << "Cloud Composer Item" << "Cloud Item" @@ -74,7 +68,7 @@ namespace pcl KD_TREE_SEARCH }; }; - class PCL_EXPORTS CloudComposerItem : public QStandardItem + class CloudComposerItem : public QStandardItem { public: @@ -87,12 +81,12 @@ namespace pcl FPFH_ITEM }; - CloudComposerItem (const QString name = "default item"); + CloudComposerItem (const QString& name = "default item"); CloudComposerItem (const CloudComposerItem& to_copy); - virtual ~CloudComposerItem (); + ~CloudComposerItem (); - inline virtual int - type () const { return CLOUD_COMPOSER_ITEM; } + inline int + type () const override { return CLOUD_COMPOSER_ITEM; } /** \brief Convenience function to get Item's ID String */ inline QString @@ -109,8 +103,8 @@ namespace pcl void addChild (CloudComposerItem* item_arg); - virtual CloudComposerItem* - clone () const; + CloudComposerItem* + clone () const override; // /** \brief Convenience function which pulls out a cloud Ptr of type CloudPtrT */ // template @@ -119,11 +113,11 @@ namespace pcl /** \brief Paint View function - reimpliment in item subclass if it can be displayed in PCLVisualizer*/ virtual void - paintView (boost::shared_ptr vis) const; + paintView (pcl::visualization::PCLVisualizer::Ptr vis) const; /** \brief Remove from View function - reimpliment in item subclass if it can be displayed in PCLVisualizer*/ virtual void - removeFromView (boost::shared_ptr vis) const; + removeFromView (pcl::visualization::PCLVisualizer::Ptr vis) const; /** \brief Inspector additional tabs paint function - reimpliment in item subclass if item has additional tabs to show in Inspector*/ virtual QMap @@ -151,31 +145,20 @@ namespace pcl template class VPtr { public: - static T* asPtr (QVariant v) + static T* asPtr (const QVariant& v) { return (static_cast (v.value ())); } static QVariant asQVariant (T* ptr) { - return (qVariantFromValue (static_cast(ptr))); + return (QVariant::fromValue (static_cast(ptr))); } }; } } -typedef QList ConstItemList; +using ConstItemList = QList; Q_DECLARE_METATYPE (pcl::cloud_composer::CloudComposerItem); - - - - - - - - - - -#endif //CLOUD_COMPOSER_ITEM_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h index bcf1a134..fd27319e 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/cloud_item.h @@ -35,16 +35,18 @@ * */ -#ifndef CLOUD_ITEM_H_ -#define CLOUD_ITEM_H_ +#pragma once + +#include #include +#include #include #include //Typedefs to make things sane -typedef pcl::visualization::PointCloudGeometryHandler GeometryHandler; -typedef pcl::visualization::PointCloudColorHandler ColorHandler; +using GeometryHandler = pcl::visualization::PointCloudGeometryHandler; +using ColorHandler = pcl::visualization::PointCloudColorHandler; namespace pcl { @@ -63,52 +65,52 @@ namespace pcl AXIS = (1 << 5), }; } - class PCL_EXPORTS CloudItem : public CloudComposerItem + class CloudItem : public CloudComposerItem { public: //This is needed because we have members which are Vector4f and Quaternionf - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW CloudItem (const QString name, - const pcl::PCLPointCloud2::Ptr cloud_ptr, + const pcl::PCLPointCloud2::Ptr& cloud_ptr, const Eigen::Vector4f& origin = Eigen::Vector4f (), const Eigen::Quaternionf& orientation = Eigen::Quaternionf (), bool make_templated_cloud = true); CloudItem (const CloudItem& to_copy); - virtual ~CloudItem (); + ~CloudItem (); /** \brief This creates a CloudItem from a templated cloud type */ template static CloudItem* - createCloudItemFromTemplate (const QString name, typename PointCloud::Ptr cloud_ptr); + createCloudItemFromTemplate (const QString& name, typename PointCloud::Ptr cloud_ptr); /** \brief virtual data getter which calls QStandardItem::data; used to create template cloud if not created yet * WARNING : This function modifies "this" - it sets up the templated type if you request one when it doesn't exist yet! * It had to remain const because it is virtual, and we need to keep run-time polymorphism */ - virtual QVariant - data (int role = Qt::UserRole +1) const; + QVariant + data (int role = Qt::UserRole +1) const override; /** \brief Virtual data setter which calls QStandardItem::data; used to ensure that template_cloud_set_ is set * when a templated cloud is added */ - virtual void - setData ( const QVariant & value, int role = Qt::UserRole + 1 ); + void + setData ( const QVariant & value, int role = Qt::UserRole + 1 ) override; - inline virtual int - type () const { return CLOUD_ITEM; } + inline int + type () const override { return CLOUD_ITEM; } - virtual CloudItem* - clone () const; + CloudItem* + clone () const override; /** \brief Paint View function - puts this cloud item into a PCLVisualizer object*/ - virtual void - paintView (boost::shared_ptr vis) const; + void + paintView (pcl::visualization::PCLVisualizer::Ptr vis) const override; /** \brief Remove from View function - removes this cloud from a PCLVisualizer object*/ - virtual void - removeFromView (boost::shared_ptr vis) const; + void + removeFromView (pcl::visualization::PCLVisualizer::Ptr vis) const override; /** \brief Initializes and stores a templated PointCloud object with point type matching the blob */ void @@ -120,8 +122,8 @@ namespace pcl template void printNumPoints () const; - virtual bool - isSanitized () const { return is_sanitized_; } + bool + isSanitized () const override { return is_sanitized_; } private: //These are just stored for convenience @@ -187,5 +189,3 @@ Q_DECLARE_METATYPE (pcl::search::KdTree::Ptr); Q_DECLARE_METATYPE (pcl::PointCloud ::Ptr); Q_DECLARE_METATYPE (pcl::PointCloud ::Ptr); Q_DECLARE_METATYPE (pcl::PointCloud ::Ptr); - -#endif //CLOUD_ITEM_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/fpfh_item.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/fpfh_item.h index bbf0093d..42feb563 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/fpfh_item.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/fpfh_item.h @@ -35,8 +35,7 @@ * */ -#ifndef FPFH_ITEM_H_ -#define FPFH_ITEM_H_ +#pragma once #include #include @@ -44,6 +43,7 @@ #include #include +class QVTKWidget; namespace pcl { @@ -55,35 +55,31 @@ namespace pcl public: FPFHItem (QString name, - pcl::PointCloud::Ptr fpfh_ptr, + const pcl::PointCloud::Ptr& fpfh_ptr, double radius); FPFHItem (const FPFHItem& to_copy); - virtual ~FPFHItem (); + ~FPFHItem (); - inline virtual int - type () const { return FPFH_ITEM; } + inline int + type () const override { return FPFH_ITEM; } - virtual FPFHItem* - clone () const; + FPFHItem* + clone () const override; /** \brief Inspector additional tabs paint function - get the histogram plot widget*/ - virtual QMap - getInspectorTabs (); + QMap + getInspectorTabs () override; private: pcl::PointCloud::Ptr fpfh_ptr_; double radius_; - boost::shared_ptr plot_; + pcl::visualization::PCLPlotter::Ptr plot_; QVTKWidget *qvtk_; QWidget *hist_page_; }; - - - + } } Q_DECLARE_METATYPE (pcl::PointCloud::Ptr); Q_DECLARE_METATYPE (pcl::PointCloud::ConstPtr); - -#endif //NORMALS_ITEM_H_ \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/normals_item.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/normals_item.h index 919646a0..0c8d2706 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/items/normals_item.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/items/normals_item.h @@ -35,10 +35,8 @@ * */ -#ifndef NORMALS_ITEM_H_ -#define NORMALS_ITEM_H_ +#pragma once -#include #include #include @@ -49,28 +47,28 @@ namespace pcl namespace cloud_composer { - class PCL_EXPORTS NormalsItem : public CloudComposerItem + class NormalsItem : public CloudComposerItem { public: NormalsItem (QString name, - pcl::PointCloud::Ptr normals_ptr, + const pcl::PointCloud::Ptr& normals_ptr, double radius); NormalsItem (const NormalsItem& to_copy); - virtual ~NormalsItem (); + ~NormalsItem (); - inline virtual int - type () const { return NORMALS_ITEM; } + inline int + type () const override { return NORMALS_ITEM; } - virtual NormalsItem* - clone () const; + NormalsItem* + clone () const override; - virtual void - paintView (boost::shared_ptr vis) const; + void + paintView (pcl::visualization::PCLVisualizer::Ptr vis) const override; /** \brief Remove from View function - removes the normal cloud from a PCLVisualizer object*/ - virtual void - removeFromView (boost::shared_ptr vis) const; + void + removeFromView (pcl::visualization::PCLVisualizer::Ptr vis) const override; private: pcl::PointCloud::Ptr normals_ptr_; @@ -84,5 +82,3 @@ namespace pcl Q_DECLARE_METATYPE (pcl::PointCloud::Ptr); Q_DECLARE_METATYPE (pcl::PointCloud::ConstPtr); - -#endif //NORMALS_ITEM_H_ \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/merge_selection.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/merge_selection.h index dfcfe9b3..6a0d4e44 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/merge_selection.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/merge_selection.h @@ -35,12 +35,10 @@ * */ -#ifndef MERGE_SELECTION_H_ -#define MERGE_SELECTION_H_ +#pragma once #include - namespace pcl { namespace cloud_composer @@ -49,20 +47,20 @@ namespace pcl { Q_OBJECT public: - MergeSelection (QMap selected_item_index_map, QObject* parent = 0); - virtual ~MergeSelection (); + MergeSelection (QMap selected_item_index_map, QObject* parent = nullptr); + ~MergeSelection (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "Merge Selection Tool";} + inline QString + getToolName () const override { return "Merge Selection Tool";} QList getSelectedItems () { return selected_item_index_map_.keys ();} template QList - performTemplatedAction (QList input_data); + performTemplatedAction (const QList & input_data); private: QMap selected_item_index_map_; @@ -70,5 +68,3 @@ namespace pcl } } - -#endif \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/click_trackball_interactor_style.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/click_trackball_interactor_style.h index f09c3b4e..cc7b9016 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/click_trackball_interactor_style.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/click_trackball_interactor_style.h @@ -35,21 +35,16 @@ * */ -#ifndef CLICK_TRACKBALL_STYLE_INTERACTOR_H_ -#define CLICK_TRACKBALL_STYLE_INTERACTOR_H_ +#pragma once #include -#include - - - namespace pcl { namespace cloud_composer { - class PCL_EXPORTS ClickTrackballStyleInteractor : public vtkInteractorStyleTrackballActor + class ClickTrackballStyleInteractor : public vtkInteractorStyleTrackballActor { public: static ClickTrackballStyleInteractor* New(); @@ -57,7 +52,7 @@ namespace pcl ClickTrackballStyleInteractor (); - virtual ~ClickTrackballStyleInteractor (); + ~ClickTrackballStyleInteractor (); /** \brief Pass a pointer to the actor map * \param[in] actors the actor map that will be used with this style @@ -76,18 +71,18 @@ namespace pcl setRendererCollection (vtkSmartPointer &rens) { renderers_ = rens; } /** \brief Function called on left mouse button release, ie, end of rectangular drag */ - virtual void - OnLeftButtonDown (); + void + OnLeftButtonDown () override; /** \brief Function called on left mouse button release, ie, end of rectangular drag */ - virtual void - OnLeftButtonUp (); + void + OnLeftButtonUp () override; - virtual void - OnRightButtonDown (); + void + OnRightButtonDown () override; - virtual void - OnRightButtonUp (); + void + OnRightButtonUp () override; /** \brief Event emitted once a valid selection has been made */ int manipulation_complete_event_; @@ -116,7 +111,3 @@ namespace pcl } } - -#endif // CLICK_TRACKBALL_STYLE_INTERACTOR_H_ - - \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h index ac942ebf..d039aa42 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/interactor_style_switch.h @@ -35,8 +35,9 @@ * */ -#ifndef INTERACTOR_STYLE_SWITCH_H_ -#define INTERACTOR_STYLE_SWITCH_H_ +#pragma once + +#include #include #include @@ -44,11 +45,7 @@ #include #include -#include - - - - +class QVTKWidget; namespace pcl { @@ -78,22 +75,22 @@ namespace pcl class ClickTrackballStyleInteractor; class ProjectModel; - class PCL_EXPORTS InteractorStyleSwitch : public vtkInteractorStyle + class InteractorStyleSwitch : public vtkInteractorStyle { public: static InteractorStyleSwitch *New(); vtkTypeMacro(InteractorStyleSwitch, vtkInteractorStyle); InteractorStyleSwitch(); - virtual ~InteractorStyleSwitch(); + ~InteractorStyleSwitch(); void - SetInteractor(vtkRenderWindowInteractor *iren); + SetInteractor(vtkRenderWindowInteractor *iren) override; vtkGetObjectMacro(current_style_, vtkInteractorStyle); void - initializeInteractorStyles (boost::shared_ptr vis, ProjectModel* model); + initializeInteractorStyles (pcl::visualization::PCLVisualizer::Ptr vis, ProjectModel* model); inline void setQVTKWidget (QVTKWidget* qvtk) { qvtk_ = qvtk; } @@ -108,13 +105,13 @@ namespace pcl getInteractorStyle (const interactor_styles::INTERACTOR_STYLES interactor_style) const { return name_to_style_map_.value (interactor_style); } - virtual - void SetDefaultRenderer(vtkRenderer*); - virtual - void SetCurrentRenderer(vtkRenderer*); - virtual void - OnLeave (); + void SetDefaultRenderer(vtkRenderer*) override; + + void SetCurrentRenderer(vtkRenderer*) override; + + void + OnLeave () override; protected: void @@ -139,7 +136,7 @@ namespace pcl /** \brief Internal pointer to QVTKWidget that this Switch works with */ QVTKWidget* qvtk_; /** \brief Internal pointer to PCLVisualizer that this Switch works with */ - boost::shared_ptr vis_; + pcl::visualization::PCLVisualizer::Ptr vis_; private: InteractorStyleSwitch(const InteractorStyleSwitch&); // Not implemented. void operator=(const InteractorStyleSwitch&); // Not implemented. @@ -149,7 +146,3 @@ namespace pcl } } - -#endif // INTERACTOR_STYLE_SWITCH_H_ - - \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h index ae0905cb..5e31ff5b 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/manipulation_event.h @@ -35,12 +35,10 @@ * */ -#ifndef MANIPULATION_EVENT_H_ -#define MANIPULATION_EVENT_H_ +#pragma once #include #include -#include namespace pcl { @@ -48,7 +46,7 @@ namespace pcl { - class PCL_EXPORTS ManipulationEvent + class ManipulationEvent { public: @@ -58,7 +56,7 @@ namespace pcl ~ManipulationEvent (); void - addManipulation (QString id, vtkSmartPointer start, vtkSmartPointer end); + addManipulation (const QString& id, const vtkSmartPointer& start, const vtkSmartPointer& end); inline QMap > getStartMap () const { return id_start_map_;} @@ -76,7 +74,3 @@ namespace pcl } } - -#endif // MANIPULATION_EVENT_H_ - - \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/rectangular_frustum_selector.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/rectangular_frustum_selector.h index 7311a25b..bc6f7dcc 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/rectangular_frustum_selector.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/rectangular_frustum_selector.h @@ -35,21 +35,16 @@ * */ -#ifndef RECTANGULAR_FRUSTRUM_SELECTOR_H_ -#define RECTANGULAR_FRUSTRUM_SELECTOR_H_ +#pragma once #include -#include - - - namespace pcl { namespace cloud_composer { - class PCL_EXPORTS RectangularFrustumSelector : public vtkInteractorStyleRubberBandPick + class RectangularFrustumSelector : public vtkInteractorStyleRubberBandPick { public: static RectangularFrustumSelector* New(); @@ -57,7 +52,7 @@ namespace pcl RectangularFrustumSelector (); - virtual ~RectangularFrustumSelector (); + ~RectangularFrustumSelector (); /** \brief Pass a pointer to the actor map * \param[in] actors the actor map that will be used with this style @@ -76,8 +71,8 @@ namespace pcl setRendererCollection (vtkSmartPointer &rens) { renderers_ = rens; } /** \brief Function called on left mouse button release, ie, end of rectangular drag */ - virtual void - OnLeftButtonUp (); + void + OnLeftButtonUp () override; /** \brief Event emitted once a valid selection has been made */ int selection_complete_event_; @@ -94,7 +89,3 @@ namespace pcl } } - -#endif // RECTANGULAR_FRUSTRUM_SELECTOR_H_ - - \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selected_trackball_interactor_style.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selected_trackball_interactor_style.h index 974a9429..58fc208c 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selected_trackball_interactor_style.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selected_trackball_interactor_style.h @@ -35,21 +35,14 @@ * */ -#ifndef SELECTED_TRACKBALL_STYLE_INTERACTOR_H_ -#define SELECTED_TRACKBALL_STYLE_INTERACTOR_H_ - #include -#include - - - namespace pcl { namespace cloud_composer { - class PCL_EXPORTS SelectedTrackballStyleInteractor : public vtkInteractorStyleTrackballActor + class SelectedTrackballStyleInteractor : public vtkInteractorStyleTrackballActor { public: static SelectedTrackballStyleInteractor* New(); @@ -57,7 +50,7 @@ namespace pcl SelectedTrackballStyleInteractor (); - virtual ~SelectedTrackballStyleInteractor (); + ~SelectedTrackballStyleInteractor (); /** \brief Pass a pointer to the actor map * \param[in] actors the actor map that will be used with this style @@ -76,27 +69,27 @@ namespace pcl setRendererCollection (vtkSmartPointer &rens) { renderers_ = rens; } /** \brief Function called on left mouse button click, ie, beginning of trackball */ - virtual void - OnLeftButtonDown (); + void + OnLeftButtonDown () override; - virtual void - OnRightButtonDown (); + void + OnRightButtonDown () override; /** \brief Function called on left mouse button release, ie, end of trackball*/ - virtual void - OnLeftButtonUp (); + void + OnLeftButtonUp () override; - virtual void - OnRightButtonUp (); + void + OnRightButtonUp () override; - virtual void - Rotate(); - virtual void - Spin(); - virtual void - Pan(); - virtual void - UniformScale(); + void + Rotate() override; + void + Spin() override; + void + Pan() override; + void + UniformScale() override; /** \brief Event emitted once a valid selection has been made */ int manipulation_complete_event_; @@ -125,7 +118,3 @@ namespace pcl } } - -#endif // SELECTED_TRACKBALL_STYLE_INTERACTOR_H_ - - \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selection_event.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selection_event.h index e3275a88..0e8dfa49 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selection_event.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/point_selectors/selection_event.h @@ -35,12 +35,10 @@ * */ -#ifndef SELECTION_EVENT_H_ -#define SELECTION_EVENT_H_ +#pragma once #include #include -#include namespace pcl { @@ -48,15 +46,15 @@ namespace pcl { class RectangularFrustumSelector; - class PCL_EXPORTS SelectionEvent + class SelectionEvent { public: SelectionEvent (vtkSmartPointer selected_points, vtkSmartPointer selected_actor, vtkSmartPointer selected_mapper, QMap < QString, vtkPolyData* > id_selected_map, vtkRenderer* renderer) - : selected_points_ (selected_points) - , selected_actor_ (selected_actor) - , selected_mapper_ (selected_mapper) - , id_selected_data_map_ (id_selected_map) + : selected_points_ (std::move(selected_points)) + , selected_actor_ (std::move(selected_actor)) + , selected_mapper_ (std::move(selected_mapper)) + , id_selected_data_map_ (std::move(id_selected_map)) , renderer_ (renderer) {} @@ -75,7 +73,7 @@ namespace pcl getActor () const { return selected_actor_; } void - findIndicesInItem (CloudItem* cloud_item, pcl::PointIndices::Ptr indices); + findIndicesInItem (CloudItem* cloud_item, const pcl::PointIndices::Ptr& indices); private: @@ -90,7 +88,3 @@ namespace pcl } } - -#endif // SELECTION_EVENT_H_ - - \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h index b2c4af6b..d4b30999 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/project_model.h @@ -35,9 +35,7 @@ * */ -#ifndef PROJECT_MODEL_H_ -#define PROJECT_MODEL_H_ - +#pragma once #include #include @@ -45,11 +43,13 @@ #include #include -#include #include #include #include +#include + +class QItemSelection; class QItemSelectionModel; namespace pcl @@ -68,11 +68,11 @@ namespace pcl Q_OBJECT public: - ProjectModel (QObject *parent = 0); + ProjectModel (QObject *parent = nullptr); ProjectModel (const ProjectModel& to_copy); - virtual ~ProjectModel (); + ~ProjectModel (); - ProjectModel (QString project_name, QObject *parent = 0); + ProjectModel (QString project_name, QObject *parent = nullptr); inline const QString getName () { return horizontalHeaderItem (0)->text (); } @@ -82,7 +82,7 @@ namespace pcl /** \brief Sets the name of the project using the horizontalHeaderItem */ void - setName (QString new_name); + setName (const QString& new_name); /** \brief Returns the selection model which is used for this project */ inline QItemSelectionModel* @@ -107,11 +107,11 @@ namespace pcl /** \brief This sets the selection for points which have been selected in the QVTKWindow */ void - setPointSelection (boost::shared_ptr selected_event); + setPointSelection (const std::shared_ptr& selected_event); /** \brief This is invoked to perform the manipulations specified on the model */ void - manipulateClouds (boost::shared_ptr manip_event); + manipulateClouds (const std::shared_ptr& manip_event); public Q_SLOTS: void commandCompleted (CloudCommand* command); @@ -156,7 +156,7 @@ namespace pcl /** \brief Selects all items in the model */ void - selectAllItems (QStandardItem* item = 0 ); + selectAllItems (QStandardItem* item = nullptr ); Q_SIGNALS: void enqueueNewAction (AbstractTool* tool, ConstItemList data); @@ -200,7 +200,7 @@ namespace pcl setSelectedStyle (interactor_styles::INTERACTOR_STYLES style); /** \brief Internal pointer storing the last selection event arriving from vtk */ - boost::shared_ptr selection_event_; + std::shared_ptr selection_event_; /** \brief Map which stores which cloud items and indices were selected in the selection_event_ */ QMap selected_item_index_map_; }; @@ -209,6 +209,3 @@ namespace pcl Q_DECLARE_METATYPE (pcl::cloud_composer::ProjectModel); Q_DECLARE_METATYPE (pcl::cloud_composer::interactor_styles::INTERACTOR_STYLES); - -#endif //PROJECT_MODEL_H - diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/properties_model.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/properties_model.h index 7a456ec3..fcc402bd 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/properties_model.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/properties_model.h @@ -35,12 +35,11 @@ * */ -#ifndef PROPERTIES_MODEL_H_ -#define PROPERTIES_MODEL_H_ +#pragma once -#include -#include +#include +#include namespace pcl { @@ -53,23 +52,23 @@ namespace pcl public: /** \brief Constructor used for tool parameters */ - PropertiesModel (QObject *parent = 0); + PropertiesModel (QObject *parent = nullptr); /** \brief Constructor used for item parameters */ - PropertiesModel (CloudComposerItem* parent_item, QObject *parent = 0); + PropertiesModel (CloudComposerItem* parent_item, QObject *parent = nullptr); PropertiesModel (const PropertiesModel& to_copy); - virtual ~PropertiesModel (); + ~PropertiesModel (); /** \brief Helper function for adding a new property */ void - addProperty (const QString prop_name, const QVariant value, const Qt::ItemFlags flags = Qt::ItemIsSelectable, const QString category = ""); + addProperty (const QString& prop_name, const QVariant& value, const Qt::ItemFlags flags = Qt::ItemIsSelectable, const QString& category = ""); /** \brief Helper function for adding a new property category */ void - addCategory (const QString category_name); + addCategory (const QString& category_name); /** \brief Helper function to get a property */ QVariant - getProperty (const QString prop_name) const; + getProperty (const QString& prop_name) const; void copyProperties (const PropertiesModel* to_copy); @@ -92,5 +91,3 @@ namespace pcl Q_DECLARE_METATYPE (pcl::cloud_composer::PropertiesModel); Q_DECLARE_METATYPE (pcl::cloud_composer::PropertiesModel*); - -#endif //PROPERTIES_MODEL_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/qt.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/qt.h deleted file mode 100644 index 0214cb08..00000000 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/qt.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012, Jeremie Papon. - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef CLOUD_COMPOSER_QT_H_ -#define CLOUD_COMPOSER_QT_H_ - -#ifdef __GNUC__ -#pragma GCC system_header -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#endif // CLOUD_COMPOSER_QT_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/signal_multiplexer.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/signal_multiplexer.h index cbf30ef4..ee74b82a 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/signal_multiplexer.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/signal_multiplexer.h @@ -40,10 +40,9 @@ * */ -#ifndef SIGNAL_MULTIPLEXER_H_ -#define SIGNAL_MULTIPLEXER_H_ +#pragma once -#include +#include namespace pcl { @@ -54,7 +53,7 @@ namespace pcl Q_OBJECT public: - SignalMultiplexer(QObject *parent = 0); + SignalMultiplexer(QObject *parent = nullptr); /** Use this connect function instead of QObject::connect() to connect @@ -148,21 +147,3 @@ namespace pcl }; } } - - - - - - - - - - - - - - - - - -#endif // SIGNAL_MULTIPLEXER_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h index 437f6478..7ec851a9 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/abstract_tool.h @@ -35,14 +35,14 @@ * */ -#ifndef ABSTRACT_TOOL_H_ -#define ABSTRACT_TOOL_H_ +#pragma once -#include #include #include #include +#include + namespace pcl { namespace cloud_composer @@ -56,7 +56,7 @@ namespace pcl AbstractTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~AbstractTool () { qDebug() << "Tool Destructed"; } + ~AbstractTool () { qDebug() << "Tool Destructed"; } /** \brief Function called which does work in plugin * \param data input_data from the model - const for good reason @@ -73,7 +73,7 @@ namespace pcl getActionText () const {return action_text_;} void - setActionText (const QString text) { action_text_ = text; } + setActionText (const QString& text) { action_text_ = text; } virtual QString getToolName () const = 0; @@ -95,19 +95,19 @@ namespace pcl : AbstractTool (parameter_model, parent) {} - virtual ~ModifyItemTool () { } + ~ModifyItemTool () { } - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) = 0; + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override = 0; - inline virtual CloudCommand* - createCommand (QList input_data) + inline CloudCommand* + createCommand (QList input_data) override { return new ModifyItemCommand (input_data); } - inline virtual QString - getToolName () const { return "ModifyItemTool";} + inline QString + getToolName () const override { return "ModifyItemTool";} }; @@ -119,19 +119,19 @@ namespace pcl : AbstractTool (parameter_model, parent) {} - virtual ~NewItemTool () { } + ~NewItemTool () { } - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) = 0; + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override = 0; - inline virtual CloudCommand* - createCommand (QList input_data) + inline CloudCommand* + createCommand (QList input_data) override { return new NewItemCloudCommand (input_data); } - inline virtual QString - getToolName () const { return "NewItemTool";} + inline QString + getToolName () const override { return "NewItemTool";} }; @@ -143,19 +143,19 @@ namespace pcl : AbstractTool (parameter_model, parent) {} - virtual ~SplitItemTool () { } + ~SplitItemTool () { } - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) = 0; + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override = 0; - inline virtual CloudCommand* - createCommand (QList input_data) + inline CloudCommand* + createCommand (QList input_data) override { return new SplitCloudCommand (input_data); } - inline virtual QString - getToolName () const { return "SplitItemTool";} + inline QString + getToolName () const override { return "SplitItemTool";} }; @@ -167,24 +167,21 @@ namespace pcl : AbstractTool (parameter_model, parent) {} - virtual ~MergeCloudTool () { } + ~MergeCloudTool () { } - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) = 0; + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override = 0; - inline virtual CloudCommand* - createCommand (QList input_data) + inline CloudCommand* + createCommand (QList input_data) override { return new MergeCloudCommand (input_data); } - inline virtual QString - getToolName () const { return "MergeCloudTool";} + inline QString + getToolName () const override { return "MergeCloudTool";} }; } } - - -#endif //ABSTRACT_TOOL_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/tool_factory.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/tool_factory.h index 37e58a58..6429f8d1 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/tool_factory.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tool_interface/tool_factory.h @@ -35,10 +35,8 @@ * */ -#ifndef TOOL_FACTORY_H_ -#define TOOL_FACTORY_H_ +#pragma once -#include #include class QAction; @@ -57,7 +55,7 @@ namespace pcl { public: virtual AbstractTool* - createTool (PropertiesModel* parameter_model = 0, QObject* parent = 0) = 0; + createTool (PropertiesModel* parameter_model = nullptr, QObject* parent = nullptr) = 0; virtual PropertiesModel* createToolParameterModel (QObject* parent) = 0; @@ -95,5 +93,3 @@ Q_DECLARE_METATYPE (pcl::cloud_composer::ToolFactory*); Q_DECLARE_INTERFACE(pcl::cloud_composer::ToolFactory, "cloud_composer.ToolFactory/1.0") - -#endif //TOOL_FACTORY_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h index e5fe2e9e..0121b56b 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/toolbox_model.h @@ -35,15 +35,19 @@ * */ -#ifndef TOOLBOX_MODEL_H_ -#define TOOLBOX_MODEL_H_ +#pragma once -#include +#include +#include -enum TOOLBOX_ROLES -{ +class QItemSelection; +class QItemSelectionModel; +class QTreeView; + +enum TOOLBOX_ROLES +{ FACTORY = Qt::UserRole, - PARAMETER_MODEL, + PARAMETER_MODEL, ALLOWED_INPUT_ITEM_TYPES, REQUIRED_INPUT_CHILDREN_TYPES }; @@ -64,9 +68,8 @@ namespace pcl Q_OBJECT public: - ToolBoxModel (QTreeView* tool_view = 0, QTreeView* parameter_view = 0, QObject *parent = 0); + ToolBoxModel (QTreeView* tool_view = nullptr, QTreeView* parameter_view = nullptr, QObject *parent = nullptr); ToolBoxModel (const ToolBoxModel& to_copy); - virtual ~ToolBoxModel (); void addTool (ToolFactory* tool_factory); @@ -76,7 +79,7 @@ namespace pcl /** \brief Enables/Disables Tools based on currently selected items from model */ void - updateEnabledTools (const QItemSelection current_selection); + updateEnabledTools (const QItemSelection& current_selection); void enableAllTools (); @@ -104,21 +107,17 @@ namespace pcl private: QStandardItem* - addToolGroup (QString tool_group_name); + addToolGroup (const QString& tool_group_name); QTreeView* tool_view_; QTreeView* parameter_view_; QItemSelectionModel* selection_model_; QSet tool_items; - ProjectModel* project_model_; - + ProjectModel* project_model_; }; } } Q_DECLARE_METATYPE (pcl::cloud_composer::ToolBoxModel); Q_DECLARE_METATYPE (QStandardItemModel*); - -#endif //TOOLBOX_MODEL_H_ - diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h index 0ba62633..14efe55c 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/euclidean_clustering.h @@ -35,13 +35,11 @@ * */ -#ifndef EUCLIDEAN_CLUSTERING_H_ -#define EUCLIDEAN_CLUSTERING_H_ +#pragma once #include #include - namespace pcl { namespace cloud_composer @@ -51,13 +49,13 @@ namespace pcl Q_OBJECT public: EuclideanClusteringTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~EuclideanClusteringTool (); + ~EuclideanClusteringTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "Euclidean Clustering Tool";} + inline QString + getToolName () const override { return "Euclidean Clustering Tool";} }; @@ -65,36 +63,34 @@ namespace pcl { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: SplitItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new EuclideanClusteringTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "Euclidean Clustering";} + inline QString + getPluginName () const override { return "Euclidean Clustering";} - inline virtual QString - getToolGroupName () const { return "Segmentation";} + inline QString + getToolGroupName () const override { return "Segmentation";} - inline virtual QString - getIconName () const { return ":/euclidean_clustering.png"; } + inline QString + getIconName () const override { return ":/euclidean_clustering.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { return QList (); } @@ -104,10 +100,3 @@ namespace pcl } } - - - - - - -#endif //EUCLIDEAN_CLUSTERING_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/fpfh_estimation.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/fpfh_estimation.h index 8a6ec86a..10deef32 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/fpfh_estimation.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/fpfh_estimation.h @@ -35,14 +35,11 @@ * */ -#ifndef FPFH_ESTIMATION_H_ -#define FPFH_ESTIMATION_H_ +#pragma once #include #include - - namespace pcl { namespace cloud_composer @@ -53,13 +50,13 @@ namespace pcl Q_OBJECT public: FPFHEstimationTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~FPFHEstimationTool (); + ~FPFHEstimationTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "FPFH Estimation Tool";} + inline QString + getToolName () const override { return "FPFH Estimation Tool";} }; @@ -67,36 +64,34 @@ namespace pcl { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: NewItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new FPFHEstimationTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "FPFH Estimation";} + inline QString + getPluginName () const override { return "FPFH Estimation";} - virtual QString - getToolGroupName () const { return "Feature Estimation";} + QString + getToolGroupName () const override { return "Feature Estimation";} - virtual QString - getIconName () const { return ":/fpfh_estimation.png"; } + QString + getIconName () const override { return ":/fpfh_estimation.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { QList input_types; return (input_types << CloudComposerItem::NORMALS_ITEM); @@ -107,10 +102,3 @@ namespace pcl } } - - - - - - -#endif //FPFH_ESTIMATION_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp index b3e8e12d..5833c72b 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp @@ -53,7 +53,7 @@ template QList - pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction (QList input_data) + pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction (const QList & input_data) { QList output; @@ -103,14 +103,13 @@ std::vector boundary_indices; mps.segmentAndRefine (regions, model_coefficients, inlier_indices, labels, label_indices, boundary_indices); - boost::shared_ptr > plane_labels = boost::make_shared > (); - for (size_t i = 0; i < label_indices.size (); ++i) - if (label_indices[i].indices.size () > (size_t) min_plane_size) + auto plane_labels = boost::make_shared > (); + for (std::size_t i = 0; i < label_indices.size (); ++i) + if (label_indices[i].indices.size () > (std::size_t) min_plane_size) plane_labels->insert (i); typename PointCloud::CloudVectorType clusters; - typename EuclideanClusterComparator::Ptr euclidean_cluster_comparator = - boost::make_shared > (); + typename EuclideanClusterComparator::Ptr euclidean_cluster_comparator(new EuclideanClusterComparator); euclidean_cluster_comparator->setInputCloud (input_cloud); euclidean_cluster_comparator->setLabels (labels); euclidean_cluster_comparator->setExcludeLabels (plane_labels); @@ -123,11 +122,11 @@ euclidean_segmentation.segment (euclidean_labels, euclidean_label_indices); pcl::IndicesPtr extracted_indices (new std::vector ()); - for (size_t i = 0; i < euclidean_label_indices.size (); i++) + for (std::size_t i = 0; i < euclidean_label_indices.size (); i++) { - if (euclidean_label_indices[i].indices.size () >= (size_t) min_cluster_size) + if (euclidean_label_indices[i].indices.size () >= (std::size_t) min_cluster_size) { - typename PointCloud::Ptr cluster = boost::shared_ptr > (new PointCloud); + typename PointCloud::Ptr cluster (new PointCloud); pcl::copyPointCloud (*input_cloud,euclidean_label_indices[i].indices,*cluster); qDebug () << "Found cluster with size " << cluster->width; QString name = input_item->text () + tr ("- Clstr %1").arg (i); @@ -138,11 +137,11 @@ } } - for (size_t i = 0; i < label_indices.size (); i++) + for (std::size_t i = 0; i < label_indices.size (); i++) { - if (label_indices[i].indices.size () >= (size_t) min_plane_size) + if (label_indices[i].indices.size () >= (std::size_t) min_plane_size) { - typename PointCloud::Ptr plane = boost::shared_ptr > (new PointCloud); + typename PointCloud::Ptr plane (new PointCloud); pcl::copyPointCloud (*input_cloud,label_indices[i].indices,*plane); qDebug () << "Found plane with size " << plane->width; QString name = input_item->text () + tr ("- Plane %1").arg (i); @@ -152,8 +151,8 @@ } } - typename PointCloud::Ptr leftovers = boost::shared_ptr > (new PointCloud); - if (extracted_indices->size () == 0) + typename PointCloud::Ptr leftovers (new PointCloud); + if (extracted_indices->empty ()) pcl::copyPointCloud (*input_cloud,*leftovers); else { @@ -175,7 +174,7 @@ } - #define PCL_INSTANTIATE_performTemplatedAction(T) template PCL_EXPORTS void pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction (QList ); + #define PCL_INSTANTIATE_performTemplatedAction(T) template void pcl::cloud_composer::OrganizedSegmentationTool::performTemplatedAction (QList ); diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp index e0b3c52f..e3754f66 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/impl/supervoxels.hpp @@ -41,12 +41,13 @@ #include #include #include +#include #include #include template QList -pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (QList input_data) +pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (const QList & input_data) { QList output; @@ -89,17 +90,18 @@ pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (QList ::Ptr > supervoxel_clusters; + std::map ::Ptr > supervoxel_clusters; super.extract (supervoxel_clusters); - std::map ::Ptr > refined_supervoxel_clusters; + std::map ::Ptr > refined_supervoxel_clusters; super.refineSupervoxels (3, refined_supervoxel_clusters); - typename pcl::PointCloud::Ptr color_segments; - color_segments= super.getColoredVoxelCloud (); - - CloudItem* cloud_item_out = CloudItem::createCloudItemFromTemplate(input_item->text(),color_segments); - + auto label_segments = super.getLabeledVoxelCloud(); + auto color_segments = pcl::make_shared>(); + pcl::copyPointCloud(*label_segments, *color_segments); + for (size_t i = 0; i < label_segments->size(); ++i) + color_segments->at(i).rgba = GlasbeyLUT::at(label_segments->at(i).label % GlasbeyLUT::size()).rgba; + CloudItem* cloud_item_out = CloudItem::createCloudItemFromTemplate(input_item->text(), color_segments); output.append (cloud_item_out); @@ -115,7 +117,7 @@ pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (QList (QList ); +#define PCL_INSTANTIATE_performTemplatedAction(T) template void pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (QList ); diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h index e9c11427..ae5caee5 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/normal_estimation.h @@ -35,13 +35,11 @@ * */ -#ifndef NORMAL_ESTIMATION_H_ -#define NORMAL_ESTIMATION_H_ +#pragma once #include #include - namespace pcl { namespace cloud_composer @@ -51,13 +49,13 @@ namespace pcl Q_OBJECT public: NormalEstimationTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~NormalEstimationTool (); + ~NormalEstimationTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "Normal Estimation Tool";} + inline QString + getToolName () const override { return "Normal Estimation Tool";} }; @@ -65,36 +63,34 @@ namespace pcl { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: NewItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new NormalEstimationTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "Normal Estimation";} + inline QString + getPluginName () const override { return "Normal Estimation";} - virtual QString - getToolGroupName () const { return "Feature Estimation";} + QString + getToolGroupName () const override { return "Feature Estimation";} - virtual QString - getIconName () const { return ":/normal_estimation.png"; } + QString + getIconName () const override { return ":/normal_estimation.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { return QList (); } @@ -104,10 +100,3 @@ namespace pcl } } - - - - - - -#endif //NORMAL_ESTIMATION_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/organized_segmentation.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/organized_segmentation.h index b73a634a..4541e2e9 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/organized_segmentation.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/organized_segmentation.h @@ -35,8 +35,7 @@ * */ - #ifndef ORGANIZED_SEGMENTATION_H_ - #define ORGANIZED_SEGMENTATION_H_ +#pragma once #include #include @@ -51,16 +50,16 @@ Q_OBJECT public: OrganizedSegmentationTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~OrganizedSegmentationTool (); + ~OrganizedSegmentationTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; template QList - performTemplatedAction (QList input_data); + performTemplatedAction (const QList & input_data); - inline virtual QString - getToolName () const { return "Organized Segmenation Tool";} + inline QString + getToolName () const override { return "Organized Segmenation Tool";} }; @@ -68,36 +67,34 @@ { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: SplitItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new OrganizedSegmentationTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "Organized Segmentation";} + inline QString + getPluginName () const override { return "Organized Segmentation";} - inline virtual QString - getToolGroupName () const { return "Segmentation";} + inline QString + getToolGroupName () const override { return "Segmentation";} - inline virtual QString - getIconName () const { return ":/organized_segmentation.png"; } + inline QString + getIconName () const override { return ":/organized_segmentation.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { QList input_types; return (input_types << CloudComposerItem::NORMALS_ITEM); @@ -108,10 +105,3 @@ } } - - - - - - - #endif //ORGANIZED_SEGMENTATION_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h index 76deb942..936fa9a0 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/sanitize_cloud.h @@ -35,13 +35,11 @@ * */ -#ifndef SANITIZE_CLOUD_H_ -#define SANITIZE_CLOUD_H_ +#pragma once #include #include - namespace pcl { namespace cloud_composer @@ -51,13 +49,13 @@ namespace pcl Q_OBJECT public: SanitizeCloudTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~SanitizeCloudTool (); + ~SanitizeCloudTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "Sanitize Cloud Tool";} + inline QString + getToolName () const override { return "Sanitize Cloud Tool";} }; @@ -65,36 +63,34 @@ namespace pcl { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: ModifyItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new SanitizeCloudTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "Sanitize Cloud";} + inline QString + getPluginName () const override { return "Sanitize Cloud";} - virtual QString - getToolGroupName () const { return "Filters";} + QString + getToolGroupName () const override { return "Filters";} - virtual QString - getIconName () const { return ":/sanitize_cloud.png"; } + QString + getIconName () const override { return ":/sanitize_cloud.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { return QList (); } @@ -104,10 +100,3 @@ namespace pcl } } - - - - - - - #endif //SANITIZE_CLOUD_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h index f5f11f80..7f2114f6 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/statistical_outlier_removal.h @@ -35,8 +35,7 @@ * */ -#ifndef STATISTICAL_OUTLIER_REMOVAL_H_ -#define STATISTICAL_OUTLIER_REMOVAL_H_ +#pragma once #include #include @@ -51,13 +50,13 @@ namespace pcl Q_OBJECT public: StatisticalOutlierRemovalTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~StatisticalOutlierRemovalTool (); + ~StatisticalOutlierRemovalTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "Statistical Outlier Removal Tool";} + inline QString + getToolName () const override { return "Statistical Outlier Removal Tool";} }; @@ -65,36 +64,34 @@ namespace pcl { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: ModifyItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new StatisticalOutlierRemovalTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "Statistical Outlier Removal";} + inline QString + getPluginName () const override { return "Statistical Outlier Removal";} - virtual QString - getToolGroupName () const { return "Filters";} + QString + getToolGroupName () const override { return "Filters";} - virtual QString - getIconName () const { return ":/statistical_outlier_removal.png"; } + QString + getIconName () const override { return ":/statistical_outlier_removal.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { return QList (); } @@ -104,10 +101,3 @@ namespace pcl } } - - - - - - -#endif //STATISTICAL_OUTLIER_REMOVAL_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/supervoxels.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/supervoxels.h index ae4bcf29..de8bc530 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/supervoxels.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/supervoxels.h @@ -35,8 +35,7 @@ * */ - #ifndef SUPERVOXELS_H_ - #define SUPERVOXELS_H_ +#pragma once #include #include @@ -51,16 +50,16 @@ Q_OBJECT public: SupervoxelsTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~SupervoxelsTool (); + ~SupervoxelsTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; template QList - performTemplatedAction (QList input_data); + performTemplatedAction (const QList & input_data); - inline virtual QString - getToolName () const { return "Voxel Superpixels Tool";} + inline QString + getToolName () const override { return "Voxel Superpixels Tool";} }; @@ -70,36 +69,34 @@ { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: SplitItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new SupervoxelsTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "Supervoxels";} + inline QString + getPluginName () const override { return "Supervoxels";} - inline virtual QString - getToolGroupName () const { return "Segmentation";} + inline QString + getToolGroupName () const override { return "Segmentation";} - inline virtual QString - getIconName () const { return ":/supervoxels.png"; } + inline QString + getIconName () const override { return ":/supervoxels.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { QList input_types; return input_types; @@ -110,10 +107,3 @@ } } - - - - - - - #endif //SUPERVOXELS_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h index 46600306..54b56b20 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/tools/voxel_grid_downsample.h @@ -35,13 +35,11 @@ * */ -#ifndef VOXEL_GRID_DOWNSAMPLE_H_ -#define VOXEL_GRID_DOWNSAMPLE_H_ +#pragma once #include #include - namespace pcl { namespace cloud_composer @@ -51,13 +49,13 @@ namespace pcl Q_OBJECT public: VoxelGridDownsampleTool (PropertiesModel* parameter_model, QObject* parent); - virtual ~VoxelGridDownsampleTool (); + ~VoxelGridDownsampleTool (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "Voxel Grid Downsample Tool";} + inline QString + getToolName () const override { return "Voxel Grid Downsample Tool";} }; @@ -65,36 +63,34 @@ namespace pcl { Q_OBJECT Q_INTERFACES (pcl::cloud_composer::ToolFactory) -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif public: ModifyItemTool* - createTool (PropertiesModel* parameter_model, QObject* parent = 0) + createTool (PropertiesModel* parameter_model, QObject* parent = nullptr) override { return new VoxelGridDownsampleTool(parameter_model, parent); } PropertiesModel* - createToolParameterModel (QObject* parent); + createToolParameterModel (QObject* parent) override; - inline virtual QString - getPluginName () const { return "Voxel Grid Downsample";} + inline QString + getPluginName () const override { return "Voxel Grid Downsample";} - virtual QString - getToolGroupName () const { return "Filters";} + QString + getToolGroupName () const override { return "Filters";} - virtual QString - getIconName () const { return ":/voxel_grid_downsample.png"; } + QString + getIconName () const override { return ":/voxel_grid_downsample.png"; } - inline virtual CloudComposerItem::ItemType - getInputItemType () const + inline CloudComposerItem::ItemType + getInputItemType () const override { return CloudComposerItem::CLOUD_ITEM; } - inline virtual QList - getRequiredInputChildrenTypes () const + inline QList + getRequiredInputChildrenTypes () const override { return QList (); } @@ -104,10 +100,3 @@ namespace pcl } } - - - - - - -#endif //VOXEL_GRID_DOWNSAMPLE_H_ diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/transform_clouds.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/transform_clouds.h index f9e53421..83982be1 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/transform_clouds.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/transform_clouds.h @@ -35,12 +35,10 @@ * */ -#ifndef TRANSFORM_CLOUDS_H_ -#define TRANSFORM_CLOUDS_H_ +#pragma once #include - namespace pcl { namespace cloud_composer @@ -49,17 +47,17 @@ namespace pcl { Q_OBJECT public: - TransformClouds (QMap > transform_map, QObject* parent = 0); - virtual ~TransformClouds (); + TransformClouds (QMap > transform_map, QObject* parent = nullptr); + ~TransformClouds (); - virtual QList - performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE); + QList + performAction (QList input_data, PointTypeFlags::PointType type = PointTypeFlags::NONE) override; - inline virtual QString - getToolName () const { return "Transform Clouds Tool";} + inline QString + getToolName () const override { return "Transform Clouds Tool";} template QList - performTemplatedAction (QList input_data); + performTemplatedAction (const QList & input_data); private: QMap > transform_map_; @@ -67,5 +65,3 @@ namespace pcl } } - -#endif \ No newline at end of file diff --git a/apps/cloud_composer/include/pcl/apps/cloud_composer/work_queue.h b/apps/cloud_composer/include/pcl/apps/cloud_composer/work_queue.h index 3361b5ec..b91a7db3 100644 --- a/apps/cloud_composer/include/pcl/apps/cloud_composer/work_queue.h +++ b/apps/cloud_composer/include/pcl/apps/cloud_composer/work_queue.h @@ -35,10 +35,9 @@ * */ -#ifndef WORK_QUEUE_H_ -#define WORK_QUEUE_H_ +#pragma once -#include "qt.h" +#include #include @@ -59,8 +58,8 @@ namespace pcl { Q_OBJECT public: - WorkQueue (QObject* parent = 0); - virtual ~WorkQueue(); + WorkQueue (QObject* parent = nullptr); + ~WorkQueue(); public Q_SLOTS: void enqueueNewAction (AbstractTool* new_tool, ConstItemList input_data); @@ -83,5 +82,3 @@ namespace pcl }; } } - -#endif //WORK_QUEUE_H_ diff --git a/apps/cloud_composer/src/cloud_browser.cpp b/apps/cloud_composer/src/cloud_browser.cpp index e6c6a099..a5ac2de9 100644 --- a/apps/cloud_composer/src/cloud_browser.cpp +++ b/apps/cloud_composer/src/cloud_browser.cpp @@ -41,4 +41,4 @@ pcl::cloud_composer::BackgroundDelegate::paint (QPainter *painter, const QStyleO QStyledItemDelegate::paint (painter, option, index); -} \ No newline at end of file +} diff --git a/apps/cloud_composer/src/cloud_composer.cpp b/apps/cloud_composer/src/cloud_composer.cpp index 6143f0c4..5b16af83 100644 --- a/apps/cloud_composer/src/cloud_composer.cpp +++ b/apps/cloud_composer/src/cloud_composer.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -11,6 +10,10 @@ #include #include +#include +#include +#include + ///////////////////////////////////////////////////////////// pcl::cloud_composer::ComposerMainWindow::ComposerMainWindow (QWidget *parent) : QMainWindow (parent) @@ -30,7 +33,7 @@ pcl::cloud_composer::ComposerMainWindow::ComposerMainWindow (QWidget *parent) qRegisterMetaType ("CloudView"); qRegisterMetaType ("ConstComposerItemList"); - current_model_ = 0; + current_model_ = nullptr; multiplexer_ = new SignalMultiplexer (this); @@ -291,7 +294,7 @@ pcl::cloud_composer::ComposerMainWindow::on_action_new_project__triggered (/*QSt int k = 2; while (name_model_map_.contains (name + tr ("-%1").arg (k))) ++k; - name = name + tr ("-%1").arg (k); + name += tr ("-%1").arg (k); } //qDebug () << "Setting name"; new_project_model->setName (name); diff --git a/apps/cloud_composer/src/cloud_view.cpp b/apps/cloud_composer/src/cloud_view.cpp index 98f159cd..f32c25cc 100644 --- a/apps/cloud_composer/src/cloud_view.cpp +++ b/apps/cloud_composer/src/cloud_view.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -6,6 +5,10 @@ #include #include +#include + +#include + pcl::cloud_composer::CloudView::CloudView (QWidget* parent) : QWidget (parent) { @@ -39,18 +42,13 @@ pcl::cloud_composer::CloudView::CloudView (ProjectModel* model, QWidget* parent) } pcl::cloud_composer::CloudView::CloudView (const CloudView& to_copy) - : QWidget () + : QWidget() , vis_ (to_copy.vis_) , model_ (to_copy.model_) , qvtk_ (to_copy.qvtk_) { } - -pcl::cloud_composer::CloudView::~CloudView () -{ -} - void pcl::cloud_composer::CloudView::setModel (ProjectModel* new_model) { @@ -284,7 +282,7 @@ pcl::cloud_composer::CloudView::setInteractorStyle (interactor_styles::INTERACTO void pcl::cloud_composer::CloudView::selectionCompleted (vtkObject*, unsigned long, void*, void* call_data) { - boost::shared_ptr selected (static_cast (call_data)); + std::shared_ptr selected (static_cast (call_data)); if (selected) { @@ -298,13 +296,12 @@ pcl::cloud_composer::CloudView::selectionCompleted (vtkObject*, unsigned long, v void pcl::cloud_composer::CloudView::manipulationCompleted (vtkObject*, unsigned long, void*, void* call_data) { - boost::shared_ptr manip_event (static_cast (call_data)); + std::shared_ptr manip_event (static_cast (call_data)); if (manip_event) { qDebug () << "Manipulation event received in cloud view!"; - model_->manipulateClouds (manip_event); - + model_->manipulateClouds (manip_event); } } diff --git a/apps/cloud_composer/src/cloud_viewer.cpp b/apps/cloud_composer/src/cloud_viewer.cpp index 295bf5fc..f9c1c385 100644 --- a/apps/cloud_composer/src/cloud_viewer.cpp +++ b/apps/cloud_composer/src/cloud_viewer.cpp @@ -1,8 +1,9 @@ -#include #include #include #include +#include + pcl::cloud_composer::CloudViewer::CloudViewer (QWidget* parent) : QTabWidget (parent) @@ -39,9 +40,8 @@ pcl::cloud_composer::ProjectModel* pcl::cloud_composer::CloudViewer::getModel () const { if (this->count() == 0) - return 0; - else - return dynamic_cast (currentWidget ())->getModel (); + return nullptr; + return dynamic_cast (currentWidget ())->getModel (); } void diff --git a/apps/cloud_composer/src/commands.cpp b/apps/cloud_composer/src/commands.cpp index a61274ad..d2237203 100644 --- a/apps/cloud_composer/src/commands.cpp +++ b/apps/cloud_composer/src/commands.cpp @@ -5,7 +5,7 @@ pcl::cloud_composer::CloudCommand::CloudCommand (QList input_data, QUndoCommand* parent) : QUndoCommand (parent) - , original_data_ (input_data) + , original_data_ (std::move(input_data)) , can_use_templates_(false) , template_type_ (-1) { @@ -51,7 +51,7 @@ bool pcl::cloud_composer::CloudCommand::canUseTemplates (ConstItemList &input_data) { //Make sure the input list isn't empty - if (input_data.size () == 0) + if (input_data.empty ()) { qCritical () << "Cannot call a templated tool on an empty input in CloudCommand::executeToolOnTemplateCloud!"; template_type_ = -2; @@ -115,10 +115,10 @@ pcl::cloud_composer::CloudCommand::executeToolOnTemplateCloud (AbstractTool* too ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// bool -pcl::cloud_composer::CloudCommand::replaceOriginalWithNew (QList originals, QList new_items) +pcl::cloud_composer::CloudCommand::replaceOriginalWithNew (const QList & originals, const QList & new_items) { //Find the input item's parent - if (originals.size () < 1) + if (originals.empty ()) { qCritical () << "No items to replace specified!"; return false; @@ -135,7 +135,7 @@ pcl::cloud_composer::CloudCommand::replaceOriginalWithNew (QList invisibleRootItem (); //Now remove all the originals @@ -161,7 +161,7 @@ pcl::cloud_composer::CloudCommand::replaceOriginalWithNew (QList originals, QList new_items) +pcl::cloud_composer::CloudCommand::restoreOriginalRemoveNew (const QList & originals, const QList & new_items) { //Now remove all the new items @@ -169,7 +169,7 @@ pcl::cloud_composer::CloudCommand::restoreOriginalRemoveNew (QList parent (); // If parent is 0, it's parent is invisiblerootitem (That's how Qt defines it... boo!) - if (parent_item == 0) + if (parent_item == nullptr) parent_item = project_model_->invisibleRootItem (); QPersistentModelIndex to_remove_index = QPersistentModelIndex(project_model_->indexFromItem (item)); if (!to_remove_index.isValid ()) @@ -205,7 +205,7 @@ pcl::cloud_composer::CloudCommand::restoreOriginalRemoveNew (QList input_data, QUndoCommand* parent) - : CloudCommand (input_data, parent) + : CloudCommand (std::move(input_data), parent) { } @@ -225,7 +225,7 @@ pcl::cloud_composer::ModifyItemCommand::runCommand (AbstractTool* tool) output = tool->performAction (input_list, static_cast (template_type_)); else output = tool->performAction (input_list); - if (output.size () == 0) + if (output.empty ()) qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a ModifyItemCommand"; else { @@ -244,10 +244,7 @@ pcl::cloud_composer::ModifyItemCommand::runCommand (AbstractTool* tool) qDebug () << "Modify Item command generated "< input_data, QUndoCommand* parent) - : CloudCommand (input_data, parent) + : CloudCommand (std::move(input_data), parent) { } @@ -304,7 +301,7 @@ pcl::cloud_composer::NewItemCloudCommand::runCommand (AbstractTool* tool) output = tool->performAction (input_list, static_cast (template_type_)); else output = tool->performAction (input_list); - if (output.size () == 0) + if (output.empty ()) qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a NewItemCloudCommand"; else { @@ -319,12 +316,8 @@ pcl::cloud_composer::NewItemCloudCommand::runCommand (AbstractTool* tool) qDebug () << "New Item command generated "< input_data, QUndoCommand* parent) - : CloudCommand (input_data, parent) + : CloudCommand (std::move(input_data), parent) { } @@ -412,7 +405,7 @@ pcl::cloud_composer::SplitCloudCommand::runCommand (AbstractTool* tool) output = tool->performAction (input_list, static_cast (template_type_)); else output = tool->performAction (input_list); - if (output.size () == 0) + if (output.empty ()) qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a SplitCloudCommand"; else { @@ -427,12 +420,8 @@ pcl::cloud_composer::SplitCloudCommand::runCommand (AbstractTool* tool) qDebug () << "Split Item command generated "< input_data, QUndoCommand* parent) - : CloudCommand (input_data, parent) + : CloudCommand (std::move(input_data), parent) { } @@ -489,7 +478,7 @@ pcl::cloud_composer::DeleteItemCommand::runCommand (AbstractTool*) output_data_.append (output_pair); this->setText ("Delete "+item->text ()); } - if (original_data_.size () > 0) + if (!original_data_.empty ()) this->setText ("Delete multiple items"); return true; } @@ -527,7 +516,7 @@ pcl::cloud_composer::DeleteItemCommand::redo () //////////// MERGE CLOUD COMMAND /////////////////////////////////////////////////////////////////////////// pcl::cloud_composer::MergeCloudCommand::MergeCloudCommand (ConstItemList input_data, QUndoCommand* parent) - : CloudCommand (input_data, parent) + : CloudCommand (std::move(input_data), parent) { } @@ -553,7 +542,7 @@ pcl::cloud_composer::MergeCloudCommand::runCommand (AbstractTool* tool) OutputPair output_pair = {original_data_, output_items}; output_data_.append (output_pair); - if (output_items.size () == 0) + if (output_items.empty ()) { qWarning () << "Warning: Tool " << tool->getToolName () << "returned no item in a MergeCloudCommand"; return false; diff --git a/apps/cloud_composer/src/item_inspector.cpp b/apps/cloud_composer/src/item_inspector.cpp index 57b412d2..b442d130 100644 --- a/apps/cloud_composer/src/item_inspector.cpp +++ b/apps/cloud_composer/src/item_inspector.cpp @@ -1,14 +1,14 @@ -#include #include #include +#include pcl::cloud_composer::ItemInspector::ItemInspector (QWidget* parent) : QTabWidget(parent) { - current_item_properties_model_ = 0; - current_project_model_ = 0; - current_selection_model_ = 0; + current_item_properties_model_ = nullptr; + current_project_model_ = nullptr; + current_selection_model_ = nullptr; parameter_view_ = new QTreeView (); addTab (parameter_view_, "Parameters"); @@ -109,10 +109,10 @@ void pcl::cloud_composer::ItemInspector::updateView () { - current_item_properties_model_ = 0; + current_item_properties_model_ = nullptr; QModelIndex current_item = current_selection_model_->currentIndex (); - const QStandardItemModel* model = 0; - CloudComposerItem* cloud_item = 0; + const QStandardItemModel* model = nullptr; + CloudComposerItem* cloud_item = nullptr; if (current_item.isValid ()) model = dynamic_cast (current_item.model ()); diff --git a/apps/cloud_composer/src/items/cloud_composer_item.cpp b/apps/cloud_composer/src/items/cloud_composer_item.cpp index e647a4c7..a975a91b 100644 --- a/apps/cloud_composer/src/items/cloud_composer_item.cpp +++ b/apps/cloud_composer/src/items/cloud_composer_item.cpp @@ -1,10 +1,8 @@ -#include #include +#include - - -pcl::cloud_composer::CloudComposerItem::CloudComposerItem (QString name) +pcl::cloud_composer::CloudComposerItem::CloudComposerItem (const QString& name) : QStandardItem(name) { //Set up the properties, store pointer locally for convenience @@ -16,11 +14,9 @@ pcl::cloud_composer::CloudComposerItem::CloudComposerItem (QString name) this->setData (QVariant::fromValue (properties_), ItemDataRole::PROPERTIES); this->setData (QVariant (item_id), ItemDataRole::ITEM_ID); - this->setForeground (QBrush (Qt::black)); - + this->setForeground (QBrush (Qt::black)); } - pcl::cloud_composer::CloudComposerItem::~CloudComposerItem () { properties_->deleteLater (); @@ -60,13 +56,13 @@ pcl::cloud_composer::CloudComposerItem::addChild (CloudComposerItem *item_arg) } void -pcl::cloud_composer::CloudComposerItem::paintView (boost::shared_ptr) const +pcl::cloud_composer::CloudComposerItem::paintView (pcl::visualization::PCLVisualizer::Ptr) const { qDebug () << "Paint View in Cloud Composer Item - doing nothing"; } void -pcl::cloud_composer::CloudComposerItem::removeFromView (boost::shared_ptr) const +pcl::cloud_composer::CloudComposerItem::removeFromView (pcl::visualization::PCLVisualizer::Ptr) const { qDebug () << "Remove from View in Cloud Composer Item - doing nothing"; } diff --git a/apps/cloud_composer/src/items/cloud_item.cpp b/apps/cloud_composer/src/items/cloud_item.cpp index b77641ba..91cd3f79 100644 --- a/apps/cloud_composer/src/items/cloud_item.cpp +++ b/apps/cloud_composer/src/items/cloud_item.cpp @@ -1,18 +1,18 @@ -#include #include #include - #include #include #include +#include + pcl::cloud_composer::CloudItem::CloudItem (QString name, - pcl::PCLPointCloud2::Ptr cloud_ptr, + const pcl::PCLPointCloud2::Ptr& cloud_ptr, const Eigen::Vector4f& origin, const Eigen::Quaternionf& orientation, bool make_templated_cloud) - : CloudComposerItem (name) + : CloudComposerItem (std::move(name)) , origin_ (origin) , orientation_ (orientation) , template_cloud_set_ (false) @@ -73,7 +73,7 @@ pcl::cloud_composer::CloudItem::~CloudItem () void -pcl::cloud_composer::CloudItem::paintView (boost::shared_ptr vis) const +pcl::cloud_composer::CloudItem::paintView (pcl::visualization::PCLVisualizer::Ptr vis) const { vis->addPointCloud (cloud_blob_ptr_, geometry_handler_, color_handler_, origin_, orientation_, getId ().toStdString ()); vis->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, properties_->getProperty ("Point Size").toDouble (), getId ().toStdString ()); @@ -82,7 +82,7 @@ pcl::cloud_composer::CloudItem::paintView (boost::shared_ptr vis) const +pcl::cloud_composer::CloudItem::removeFromView (pcl::visualization::PCLVisualizer::Ptr vis) const { vis->removePointCloud (getId ().toStdString ()); } @@ -113,29 +113,27 @@ pcl::cloud_composer::CloudItem::setTemplateCloudFromBlob () { if (! template_cloud_set_ ) { - std::vector::iterator end = cloud_blob_ptr_->fields.end (); - std::vector::iterator itr = cloud_blob_ptr_->fields.begin (); QStringList field_names; - for ( itr = cloud_blob_ptr_->fields.begin () ; itr != end; ++itr) + for (const auto &field : cloud_blob_ptr_->fields) { - field_names.append (QString::fromStdString ( itr->name )); + field_names.append (QString::fromStdString ( field.name )); } point_type_ = PointTypeFlags::NONE; if (field_names.contains ("x") && field_names.contains ("y") && field_names.contains ("z")) point_type_ = (point_type_ | PointTypeFlags::XYZ); if (field_names.contains ("rgb")) - point_type_ = point_type_ | PointTypeFlags::RGB; + point_type_ |= PointTypeFlags::RGB; if (field_names.contains ("rgba")) - point_type_ = point_type_ | PointTypeFlags::RGBA; + point_type_ |= PointTypeFlags::RGBA; if (field_names.contains ("normal_x") && field_names.contains ("normal_y") && field_names.contains ("normal_z")) { if (field_names.contains ("curvature")) - point_type_ = point_type_ | PointTypeFlags::NORMAL; + point_type_ |= PointTypeFlags::NORMAL; else - point_type_ = point_type_ | PointTypeFlags::AXIS; + point_type_ |= PointTypeFlags::AXIS; } if (field_names.contains ("h") && field_names.contains ("s") && field_names.contains ("v")) - point_type_ = point_type_ | PointTypeFlags::HSV; + point_type_ |= PointTypeFlags::HSV; QVariant cloud_pointer_variant; QVariant kd_tree_variant; @@ -143,7 +141,7 @@ pcl::cloud_composer::CloudItem::setTemplateCloudFromBlob () { case (PointTypeFlags::XYZ): { - pcl::PointCloud ::Ptr cloud_ptr = boost::shared_ptr > (new pcl::PointCloud ); + pcl::PointCloud ::Ptr cloud_ptr (new pcl::PointCloud ); pcl::fromPCLPointCloud2 (*cloud_blob_ptr_, *cloud_ptr); cloud_pointer_variant = QVariant::fromValue (cloud_ptr); //Initialize the search kd-tree for this cloud @@ -154,7 +152,7 @@ pcl::cloud_composer::CloudItem::setTemplateCloudFromBlob () } case (PointTypeFlags::XYZ | PointTypeFlags::RGB): { - pcl::PointCloud ::Ptr cloud_ptr = boost::shared_ptr > (new pcl::PointCloud ); + pcl::PointCloud ::Ptr cloud_ptr (new pcl::PointCloud ); pcl::fromPCLPointCloud2 (*cloud_blob_ptr_, *cloud_ptr); cloud_pointer_variant = QVariant::fromValue (cloud_ptr); pcl::search::KdTree::Ptr kd_search = boost::make_shared >(); @@ -164,7 +162,7 @@ pcl::cloud_composer::CloudItem::setTemplateCloudFromBlob () } case (PointTypeFlags::XYZ | PointTypeFlags::RGBA): { - pcl::PointCloud ::Ptr cloud_ptr = boost::shared_ptr > (new pcl::PointCloud ); + pcl::PointCloud ::Ptr cloud_ptr (new pcl::PointCloud ); pcl::fromPCLPointCloud2 (*cloud_blob_ptr_, *cloud_ptr); cloud_pointer_variant = QVariant::fromValue (cloud_ptr); pcl::search::KdTree::Ptr kd_search = boost::make_shared >(); @@ -174,7 +172,7 @@ pcl::cloud_composer::CloudItem::setTemplateCloudFromBlob () } case (PointTypeFlags::NONE): - QMessageBox::warning (0,"Unknown blob type!", "Could not find appropriate template type for this cloud blob! Only blob functionality enabled!"); + QMessageBox::warning (nullptr,"Unknown blob type!", "Could not find appropriate template type for this cloud blob! Only blob functionality enabled!"); } this->setData (cloud_pointer_variant, ItemDataRole::CLOUD_TEMPLATED); @@ -199,9 +197,6 @@ pcl::cloud_composer::CloudItem::checkIfFinite () pass_filter.setKeepOrganized (false); pass_filter.filter (*cloud_filtered); - if (cloud_filtered->data.size() == cloud_blob_ptr_->data.size ()) - return true; - - return false; + return cloud_filtered->data.size() == cloud_blob_ptr_->data.size (); } diff --git a/apps/cloud_composer/src/items/fpfh_item.cpp b/apps/cloud_composer/src/items/fpfh_item.cpp index e6df40ee..4ee81783 100644 --- a/apps/cloud_composer/src/items/fpfh_item.cpp +++ b/apps/cloud_composer/src/items/fpfh_item.cpp @@ -1,9 +1,12 @@ #include -#include #include -pcl::cloud_composer::FPFHItem::FPFHItem (QString name, pcl::PointCloud::Ptr fpfh_ptr, double radius) - : CloudComposerItem (name) +#include + +#include + +pcl::cloud_composer::FPFHItem::FPFHItem (QString name, const pcl::PointCloud::Ptr& fpfh_ptr, double radius) + : CloudComposerItem (std::move(name)) , fpfh_ptr_ (fpfh_ptr) , radius_ (radius) @@ -11,13 +14,10 @@ pcl::cloud_composer::FPFHItem::FPFHItem (QString name, pcl::PointCloud::ConstPtr fpfh_const = fpfh_ptr; this->setData (QVariant::fromValue (fpfh_const), ItemDataRole::CLOUD_TEMPLATED); properties_->addCategory ("Core Properties"); - properties_->addProperty ("Radius", QVariant (radius_), Qt::ItemIsEnabled, "Core Properties"); - - + properties_->addProperty ("Radius", QVariant (radius_), Qt::ItemIsEnabled, "Core Properties"); } pcl::cloud_composer::FPFHItem* - pcl::cloud_composer::FPFHItem::clone () const { pcl::PointCloud::Ptr fpfh_copy (new pcl::PointCloud (*fpfh_ptr_)); @@ -30,19 +30,16 @@ pcl::cloud_composer::FPFHItem::clone () const } pcl::cloud_composer::FPFHItem::~FPFHItem () -{ - +{ } QMap pcl::cloud_composer::FPFHItem::getInspectorTabs () -{ - - +{ //Create the plotter and QVTKWidget if it doesn't exist if (!plot_) { - plot_ = boost::shared_ptr (new pcl::visualization::PCLPlotter); + plot_.reset (new pcl::visualization::PCLPlotter); qvtk_ = new QVTKWidget (); hist_page_ = new QWidget (); QGridLayout *mainLayout = new QGridLayout (hist_page_); diff --git a/apps/cloud_composer/src/items/normals_item.cpp b/apps/cloud_composer/src/items/normals_item.cpp index 00728189..f5bb617c 100644 --- a/apps/cloud_composer/src/items/normals_item.cpp +++ b/apps/cloud_composer/src/items/normals_item.cpp @@ -1,10 +1,10 @@ -#include #include #include +#include -pcl::cloud_composer::NormalsItem::NormalsItem (QString name, pcl::PointCloud::Ptr normals_ptr, double radius) - : CloudComposerItem (name) +pcl::cloud_composer::NormalsItem::NormalsItem (QString name, const pcl::PointCloud::Ptr& normals_ptr, double radius) + : CloudComposerItem (std::move(name)) , normals_ptr_ (normals_ptr) { @@ -36,7 +36,7 @@ pcl::cloud_composer::NormalsItem::~NormalsItem () } void -pcl::cloud_composer::NormalsItem::paintView (boost::shared_ptr vis) const +pcl::cloud_composer::NormalsItem::paintView (pcl::visualization::PCLVisualizer::Ptr vis) const { //Get the parent cloud, convert to XYZ if (parent ()->type () == CLOUD_ITEM) @@ -60,7 +60,7 @@ pcl::cloud_composer::NormalsItem::paintView (boost::shared_ptr vis) const +pcl::cloud_composer::NormalsItem::removeFromView (pcl::visualization::PCLVisualizer::Ptr vis) const { //qDebug () << "Removing Normals "<removePointCloud (getId ().toStdString ()); diff --git a/apps/cloud_composer/src/main.cpp b/apps/cloud_composer/src/main.cpp index 0b81adae..939bad15 100644 --- a/apps/cloud_composer/src/main.cpp +++ b/apps/cloud_composer/src/main.cpp @@ -9,5 +9,5 @@ main (int argc, char ** argv) pcl::cloud_composer::ComposerMainWindow cc; cc.show (); - return (app.exec ()); -} \ No newline at end of file + return (QApplication::exec ()); +} diff --git a/apps/cloud_composer/src/merge_selection.cpp b/apps/cloud_composer/src/merge_selection.cpp index 1b80784e..13e4c79b 100644 --- a/apps/cloud_composer/src/merge_selection.cpp +++ b/apps/cloud_composer/src/merge_selection.cpp @@ -7,8 +7,8 @@ #include pcl::cloud_composer::MergeSelection::MergeSelection (QMap selected_item_index_map, QObject* parent) - : MergeCloudTool (0, parent) - , selected_item_index_map_ (selected_item_index_map) + : MergeCloudTool (nullptr, parent) + , selected_item_index_map_ (std::move(selected_item_index_map)) { } @@ -23,7 +23,7 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po { if (type != PointTypeFlags::NONE) { - switch ((uint8_t) type) + switch ((std::uint8_t) type) { case (PointTypeFlags::XYZ): return this->performTemplatedAction (input_data); @@ -37,7 +37,7 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po QList output; // Check input data length - if ( input_data.size () == 0 && selected_item_index_map_.isEmpty() ) + if ( input_data.empty () && selected_item_index_map_.isEmpty() ) { qCritical () << "Empty input in MergeSelection!"; return output; @@ -89,7 +89,7 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po , source_orientation); output.append (new_cloud_item); pcl::PCLPointCloud2::Ptr temp_cloud = boost::make_shared (); - concatenatePointCloud (*merged_cloud, *selected_points, *temp_cloud); + concatenate (*merged_cloud, *selected_points, *temp_cloud); merged_cloud = temp_cloud; } //Append the input item to the original list @@ -101,7 +101,7 @@ pcl::cloud_composer::MergeSelection::performAction (ConstItemList input_data, Po pcl::PCLPointCloud2::ConstPtr input_cloud = input_item->data (ItemDataRole::CLOUD_BLOB).value (); pcl::PCLPointCloud2::Ptr temp_cloud = boost::make_shared (); - concatenatePointCloud (*merged_cloud, *input_cloud, *temp_cloud); + concatenate (*merged_cloud, *input_cloud, *temp_cloud); merged_cloud = temp_cloud; } diff --git a/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp b/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp index e9dc1595..e316c55f 100644 --- a/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp +++ b/apps/cloud_composer/src/point_selectors/click_trackball_interactor_style.cpp @@ -2,6 +2,7 @@ #include #include +#include namespace pcl { @@ -12,7 +13,6 @@ namespace pcl } pcl::cloud_composer::ClickTrackballStyleInteractor::ClickTrackballStyleInteractor () - : vtkInteractorStyleTrackballActor () { manipulation_complete_event_ = interactor_events::MANIPULATION_COMPLETE_EVENT; start_matrix_= vtkSmartPointer::New (); diff --git a/apps/cloud_composer/src/point_selectors/interactor_style_switch.cpp b/apps/cloud_composer/src/point_selectors/interactor_style_switch.cpp index 672e9a0c..b1f3f597 100644 --- a/apps/cloud_composer/src/point_selectors/interactor_style_switch.cpp +++ b/apps/cloud_composer/src/point_selectors/interactor_style_switch.cpp @@ -4,6 +4,8 @@ #include #include +#include + namespace pcl { namespace cloud_composer @@ -29,7 +31,7 @@ pcl::cloud_composer::InteractorStyleSwitch::InteractorStyleSwitch () area_picker_ = vtkSmartPointer::New(); point_picker_ = vtkSmartPointer::New (); - current_style_ = 0; + current_style_ = nullptr; } @@ -39,10 +41,10 @@ pcl::cloud_composer::InteractorStyleSwitch::~InteractorStyleSwitch () } void -pcl::cloud_composer::InteractorStyleSwitch::initializeInteractorStyles (boost::shared_ptr vis, ProjectModel* model) +pcl::cloud_composer::InteractorStyleSwitch::initializeInteractorStyles (pcl::visualization::PCLVisualizer::Ptr vis, ProjectModel* model) { qDebug () << "Initializing Interactor Styles"; - vis_ = vis; + vis_ = std::move(vis); project_model_ = model; pcl_vis_style_->Initialize (); @@ -65,7 +67,7 @@ pcl::cloud_composer::InteractorStyleSwitch::setCurrentInteractorStyle (interacto qDebug () << "Setting interactor style"; vtkSmartPointer style_ptr = name_to_style_map_.value (interactor_style); if (current_style_) - current_style_->SetInteractor (0); + current_style_->SetInteractor (nullptr); current_style_= style_ptr; if (current_style_) diff --git a/apps/cloud_composer/src/point_selectors/manipulation_event.cpp b/apps/cloud_composer/src/point_selectors/manipulation_event.cpp index 2fa776af..7021de8b 100644 --- a/apps/cloud_composer/src/point_selectors/manipulation_event.cpp +++ b/apps/cloud_composer/src/point_selectors/manipulation_event.cpp @@ -7,9 +7,9 @@ pcl::cloud_composer::ManipulationEvent::~ManipulationEvent () } void -pcl::cloud_composer::ManipulationEvent::addManipulation (QString id, vtkSmartPointer start, vtkSmartPointer end) +pcl::cloud_composer::ManipulationEvent::addManipulation (const QString& id, const vtkSmartPointer& start, const vtkSmartPointer& end) { id_start_map_.insert (id, start); id_end_map_.insert (id, end); -} \ No newline at end of file +} diff --git a/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp b/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp index 81efe2a0..c237692c 100644 --- a/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp +++ b/apps/cloud_composer/src/point_selectors/rectangular_frustum_selector.cpp @@ -1,6 +1,8 @@ #include #include +#include + namespace pcl { namespace cloud_composer @@ -10,7 +12,6 @@ namespace pcl } pcl::cloud_composer::RectangularFrustumSelector::RectangularFrustumSelector () - : vtkInteractorStyleRubberBandPick () { selection_complete_event_ = interactor_events::SELECTION_COMPLETE_EVENT; } @@ -45,50 +46,30 @@ pcl::cloud_composer::RectangularFrustumSelector::OnLeftButtonUp () vtkSmartPointer append = vtkAppendPolyData::New (); - pcl::visualization::CloudActorMap::iterator it; - it = actors_->begin (); QMap < QString, vtkPolyData* > id_selected_data_map; - for (it = actors_->begin (); it != actors_->end (); ++it) + for (const auto &actor : *actors_) { - pcl::visualization::CloudActor *act = &(*it).second; + const pcl::visualization::CloudActor *act = &actor.second; vtkMapper* mapper = act->actor->GetMapper (); vtkDataSet* data = mapper->GetInput (); vtkPolyData* poly_data = vtkPolyData::SafeDownCast (data); -#if VTK_MAJOR_VERSION > 5 id_filter->SetInputData (poly_data); -#else - id_filter->SetInput (poly_data); -#endif - //extract_geometry->SetInput (poly_data); - + vtkSmartPointer selected = vtkSmartPointer::New (); glyph_filter->SetOutput (selected); glyph_filter->Update (); -#if VTK_MAJOR_VERSION < 6 - selected->SetSource (0); -#endif if (selected->GetNumberOfPoints() > 0) { qDebug () << "Selected " << selected->GetNumberOfPoints () << " points."; - id_selected_data_map.insert ( QString::fromStdString ((*it).first), selected); - #if VTK_MAJOR_VERSION < 6 - append->AddInput (selected); - #else // VTK 6 - append->AddInputData (selected); - #endif + id_selected_data_map.insert ( QString::fromStdString (actor.first), selected); + append->AddInputData (selected); } - - } append->Update (); vtkSmartPointer all_points = append->GetOutput (); qDebug () << "Allpoints = " <GetNumberOfPoints (); -#if VTK_MAJOR_VERSION < 6 - selected_mapper->SetInput (all_points); -#else selected_mapper->SetInputData (all_points); -#endif selected_mapper->ScalarVisibilityOff (); selected_actor->GetProperty ()->SetColor (0.0, 1.0, 0.0); //(R,G,B) @@ -96,7 +77,7 @@ pcl::cloud_composer::RectangularFrustumSelector::OnLeftButtonUp () this->CurrentRenderer->AddActor (selected_actor); this->GetInteractor ()->GetRenderWindow ()->Render (); - this->HighlightProp (NULL); + this->HighlightProp (nullptr); if (all_points->GetNumberOfPoints () > 0) { diff --git a/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp b/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp index e58cc603..dc145333 100644 --- a/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp +++ b/apps/cloud_composer/src/point_selectors/selected_trackball_interactor_style.cpp @@ -1,6 +1,9 @@ #include #include +#include +#include + namespace pcl { namespace cloud_composer @@ -10,10 +13,8 @@ namespace pcl } pcl::cloud_composer::SelectedTrackballStyleInteractor::SelectedTrackballStyleInteractor () - : vtkInteractorStyleTrackballActor () { - manipulation_complete_event_ = interactor_events::MANIPULATION_COMPLETE_EVENT; - + manipulation_complete_event_ = interactor_events::MANIPULATION_COMPLETE_EVENT; } pcl::cloud_composer::SelectedTrackballStyleInteractor::~SelectedTrackballStyleInteractor () @@ -34,13 +35,12 @@ pcl::cloud_composer::SelectedTrackballStyleInteractor::setSelectedActors () selected_cloud_ids.append (cloud_item->getId ()); } - pcl::visualization::CloudActorMap::iterator it; - for (it = actors_->begin (); it != actors_->end (); ++it) + for (const auto &actorItem : *actors_) { - QString id = QString::fromStdString (it->first); + QString id = QString::fromStdString (actorItem.first); if (selected_cloud_ids.contains (id)) { - vtkLODActor* actor = (it->second).actor; + vtkLODActor* actor = actorItem.second.actor; qDebug () << "Adding "<indices.resize (point_ids->GetNumberOfTuples ()); - for(int i =0; i < point_ids->GetNumberOfTuples (); ++i) + for(vtkIdType i =0; i < point_ids->GetNumberOfTuples (); ++i) { //qDebug () << "id="<GetValue (i); indices->indices[i] = point_ids->GetValue (i); diff --git a/apps/cloud_composer/src/project_model.cpp b/apps/cloud_composer/src/project_model.cpp index 70e26230..91e11514 100644 --- a/apps/cloud_composer/src/project_model.cpp +++ b/apps/cloud_composer/src/project_model.cpp @@ -1,4 +1,3 @@ -#include #include #include #include @@ -7,7 +6,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include pcl::cloud_composer::ProjectModel::ProjectModel (QObject* parent) : QStandardItemModel (parent) @@ -49,7 +54,7 @@ pcl::cloud_composer::ProjectModel::ProjectModel (QObject* parent) } pcl::cloud_composer::ProjectModel::ProjectModel (const ProjectModel&) - : QStandardItemModel () +: QStandardItemModel () { } @@ -64,11 +69,11 @@ pcl::cloud_composer::ProjectModel::ProjectModel (QString project_name, QObject* : QStandardItemModel (parent) { selection_model_ = new QItemSelectionModel(this); - setName (project_name); + setName (std::move(project_name)); } void -pcl::cloud_composer::ProjectModel::setName (QString new_name) +pcl::cloud_composer::ProjectModel::setName (const QString& new_name) { //If it hasn't been set yet if (!horizontalHeaderItem (0)) @@ -90,7 +95,7 @@ pcl::cloud_composer::ProjectModel::setCloudView (CloudView* view) } void -pcl::cloud_composer::ProjectModel::setPointSelection (boost::shared_ptr selected_event) +pcl::cloud_composer::ProjectModel::setPointSelection (const std::shared_ptr& selected_event) { selection_event_ = selected_event; //Get all the items in this project that are clouds @@ -106,9 +111,9 @@ pcl::cloud_composer::ProjectModel::setPointSelection (boost::shared_ptr(); + pcl::PointIndices::Ptr found_indices = pcl::make_shared(); selected_event->findIndicesInItem (cloud_item, found_indices); - if (found_indices->indices.size () > 0) + if (!found_indices->indices.empty ()) { qDebug () << "Found "<indices.size ()<<" points in "<text (); selected_item_index_map_. insert (cloud_item, found_indices); @@ -120,7 +125,7 @@ pcl::cloud_composer::ProjectModel::setPointSelection (boost::shared_ptr manip_event) +pcl::cloud_composer::ProjectModel::manipulateClouds (const std::shared_ptr& manip_event) { //Get all the items in this project that are clouds @@ -158,18 +163,15 @@ void pcl::cloud_composer::ProjectModel::insertNewCloudFromFile () { qDebug () << "Inserting cloud from file..."; - QString filename = QFileDialog::getOpenFileName (0,tr ("Select cloud to open"), last_directory_.absolutePath (), tr ("PointCloud(*.pcd)")); + QString filename = QFileDialog::getOpenFileName (nullptr,tr ("Select cloud to open"), last_directory_.absolutePath (), tr ("PointCloud(*.pcd)")); if ( filename.isNull ()) { qWarning () << "No file selected, no cloud loaded"; return; } - else - { - QFileInfo file_info (filename); - last_directory_ = file_info.absoluteDir (); - } - + QFileInfo file_info (filename); + last_directory_ = file_info.absoluteDir (); + pcl::PCLPointCloud2::Ptr cloud_blob (new pcl::PCLPointCloud2); Eigen::Vector4f origin; Eigen::Quaternionf orientation; @@ -187,20 +189,19 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromFile () return; } - QFileInfo file_info (filename); QString short_filename = file_info.baseName (); //Check if this name already exists in the project - if so, append digit QList items = findItems (short_filename); - if (items.size () > 0) + if (!items.empty ()) { int k = 2; items = findItems (short_filename+ tr ("-%1").arg (k)); - while (items.size () > 0) + while (!items.empty ()) { ++k; items = findItems (short_filename+ tr ("-%1").arg (k)); } - short_filename = short_filename+ tr ("-%1").arg (k); + short_filename += tr ("-%1").arg (k); } CloudItem* new_item = new CloudItem (short_filename, cloud_blob, origin, orientation, true); @@ -212,34 +213,31 @@ void pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth () { qDebug () << "Inserting cloud from RGB and Depth files..."; - QString rgb_filename = QFileDialog::getOpenFileName (0,tr ("Select rgb image file to open"), last_directory_.absolutePath (), tr ("Images(*.png *.bmp *.tif *.ppm)")); + QString rgb_filename = QFileDialog::getOpenFileName (nullptr,tr ("Select rgb image file to open"), last_directory_.absolutePath (), tr ("Images(*.png *.bmp *.tif *.ppm)")); QString depth_filename; if ( rgb_filename.isNull ()) { qWarning () << "No file selected, no cloud loaded"; return; } - else + QFileInfo file_info (rgb_filename); + last_directory_ = file_info.absoluteDir (); + QString base_name = file_info.baseName (); + QStringList depth_filter; + depth_filter << base_name.split("_").at(0) + "_depth.*"; + last_directory_.setNameFilters (depth_filter); + QFileInfoList depth_info_list = last_directory_.entryInfoList (); + if (depth_info_list.empty ()) + { + qCritical () << "Could not find depth file in format (rgb file base name)_depth.*"; + return; + } + if (depth_info_list.size () > 1) { - QFileInfo file_info (rgb_filename); - last_directory_ = file_info.absoluteDir (); - QString base_name = file_info.baseName (); - QStringList depth_filter; - depth_filter << base_name.split("_").at(0) + "_depth.*"; - last_directory_.setNameFilters (depth_filter); - QFileInfoList depth_info_list = last_directory_.entryInfoList (); - if (depth_info_list.size () == 0) - { - qCritical () << "Could not find depth file in format (rgb file base name)_depth.*"; - return; - } - else if (depth_info_list.size () > 1) - { - qWarning () << "Found more than one file which matches depth naming format, using first one!"; - } - depth_filename = depth_info_list.at (0).absoluteFilePath (); + qWarning () << "Found more than one file which matches depth naming format, using first one!"; } - + depth_filename = depth_info_list.at (0).absoluteFilePath (); + //Read the images vtkSmartPointer reader_factory = vtkSmartPointer::New (); vtkImageReader2* rgb_reader = reader_factory->CreateImageReader2 (rgb_filename.toStdString ().c_str ()); @@ -274,7 +272,7 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth () return; } qDebug () << "Images loaded, making cloud"; - PointCloud::Ptr cloud = boost::shared_ptr > (new PointCloud); + PointCloud::Ptr cloud (new PointCloud); cloud->points.reserve (depth_dims[0] * depth_dims[1]); cloud->width = depth_dims[0]; cloud->height = depth_dims[1]; @@ -292,12 +290,12 @@ pcl::cloud_composer::ProjectModel::insertNewCloudFromRGBandDepth () depth_pixel = static_cast(depth_image->GetScalarPointer (depth_dims[0]-1,depth_dims[1]-1,0)); color_pixel = static_cast (rgb_image->GetScalarPointer (depth_dims[0]-1,depth_dims[1]-1,0)); - for (uint32_t y=0; yheight; ++y) + for (std::uint32_t y=0; yheight; ++y) { - for (uint32_t x=0; xwidth; ++x, --depth_pixel, color_pixel-=3) + for (std::uint32_t x=0; xwidth; ++x, --depth_pixel, color_pixel-=3) { PointXYZRGB new_point; - // uint8_t* p_i = &(cloud_blob->data[y * cloud_blob->row_step + x * cloud_blob->point_step]); + // std::uint8_t* p_i = &(cloud_blob->data[y * cloud_blob->row_step + x * cloud_blob->point_step]); float depth = (float)(*depth_pixel) * scale; // qDebug () << "Depth = "< (&rgb); + + new_point.r = color_pixel[0]; + new_point.g = color_pixel[1]; + new_point.b = color_pixel[2]; cloud->points.push_back (new_point); // qDebug () << "depth = "< items = findItems (short_filename); - if (items.size () > 0) + if (!items.empty ()) { int k = 2; items = findItems (short_filename+ tr ("-%1").arg (k)); - while (items.size () > 0) + while (!items.empty ()) { ++k; items = findItems (short_filename+ tr ("-%1").arg (k)); } - short_filename = short_filename+ tr ("-%1").arg (k); + short_filename += tr ("-%1").arg (k); } CloudItem* new_item = CloudItem::createCloudItemFromTemplate (short_filename,cloud); @@ -346,12 +345,12 @@ pcl::cloud_composer::ProjectModel::saveSelectedCloudToFile () { qDebug () << "Saving cloud to file..."; QModelIndexList selected_indexes = selection_model_->selectedIndexes (); - if (selected_indexes.size () == 0) + if (selected_indexes.empty ()) { QMessageBox::warning (qobject_cast(this->parent ()), "No Cloud Selected", "Cannot save, no cloud is selected in the browser or cloud view"); return; } - else if (selected_indexes.size () > 1) + if (selected_indexes.size () > 1) { QMessageBox::warning (qobject_cast(this->parent ()), "Too many clouds Selected", "Cannot save, currently only support saving one cloud at a time"); return; @@ -365,18 +364,15 @@ pcl::cloud_composer::ProjectModel::saveSelectedCloudToFile () return; } - QString filename = QFileDialog::getSaveFileName (0,tr ("Save Cloud"), last_directory_.absolutePath (), tr ("PointCloud(*.pcd)")); + QString filename = QFileDialog::getSaveFileName (nullptr,tr ("Save Cloud"), last_directory_.absolutePath (), tr ("PointCloud(*.pcd)")); if ( filename.isNull ()) { qWarning () << "No file selected, not saving"; return; } - else - { - QFileInfo file_info (filename); - last_directory_ = file_info.absoluteDir (); - } - + QFileInfo file_info (filename); + last_directory_ = file_info.absoluteDir (); + pcl::PCLPointCloud2::ConstPtr cloud = cloud_to_save->data (ItemDataRole::CLOUD_BLOB).value (); Eigen::Vector4f origin = cloud_to_save->data (ItemDataRole::ORIGIN).value (); Eigen::Quaternionf orientation = cloud_to_save->data (ItemDataRole::ORIENTATION).value (); @@ -391,7 +387,7 @@ pcl::cloud_composer::ProjectModel::enqueueToolAction (AbstractTool* tool) //Get the currently selected item(s), put them in a list, and create the command ConstItemList input_data; QModelIndexList selected_indexes = selection_model_->selectedIndexes (); - if (selected_indexes.size () == 0) + if (selected_indexes.empty ()) { QMessageBox::warning (qobject_cast(this->parent ()), "No Items Selected", "Cannot use tool, no item is selected in the browser or cloud view"); return; @@ -454,7 +450,7 @@ pcl::cloud_composer::ProjectModel::deleteSelectedItems () { QModelIndexList selected_indexes = selection_model_->selectedIndexes (); - if (selected_indexes.size () == 0) + if (selected_indexes.empty ()) { QMessageBox::warning (qobject_cast(this->parent ()), "No Items Selected", "Cannot execute delete command, no item is selected in the browser or cloud view"); return; @@ -471,7 +467,7 @@ pcl::cloud_composer::ProjectModel::deleteSelectedItems () // qDebug () << "Input for command is "<setInputData (input_data); - if (delete_command->runCommand (0)) + if (delete_command->runCommand (nullptr)) commandCompleted(delete_command); else qCritical () << "Execution of delete command failed!"; diff --git a/apps/cloud_composer/src/properties_model.cpp b/apps/cloud_composer/src/properties_model.cpp index c3397e42..7ec4015b 100644 --- a/apps/cloud_composer/src/properties_model.cpp +++ b/apps/cloud_composer/src/properties_model.cpp @@ -1,14 +1,13 @@ #include #include +#include pcl::cloud_composer::PropertiesModel::PropertiesModel (QObject* parent) : QStandardItemModel (parent) { setHorizontalHeaderItem (0, new QStandardItem ("Name")); - setHorizontalHeaderItem (1, new QStandardItem ("Value")); - - + setHorizontalHeaderItem (1, new QStandardItem ("Value")); } pcl::cloud_composer::PropertiesModel::PropertiesModel (CloudComposerItem* parent_item, QObject* parent) @@ -19,12 +18,11 @@ pcl::cloud_composer::PropertiesModel::PropertiesModel (CloudComposerItem* parent setHorizontalHeaderItem (1, new QStandardItem ("Value")); connect (this, SIGNAL (itemChanged (QStandardItem*)), - this, SLOT (propertyChanged (QStandardItem*))); - + this, SLOT (propertyChanged (QStandardItem*))); } pcl::cloud_composer::PropertiesModel::PropertiesModel (const PropertiesModel& to_copy) - : QStandardItemModel () +: QStandardItemModel () { for (int i=0; i < to_copy.rowCount (); ++i){ QList new_row; @@ -41,18 +39,17 @@ pcl::cloud_composer::PropertiesModel::PropertiesModel (const PropertiesModel& to } pcl::cloud_composer::PropertiesModel::~PropertiesModel () -{ - +{ } void -pcl::cloud_composer::PropertiesModel::addProperty (const QString prop_name, QVariant value, Qt::ItemFlags flags, QString category) +pcl::cloud_composer::PropertiesModel::addProperty (const QString& prop_name, const QVariant& value, Qt::ItemFlags flags, const QString& category) { QStandardItem* parent_item = invisibleRootItem (); if (category.size () > 0) { QList items = findItems (category); - if (items.size () == 0) + if (items.empty ()) qWarning () << "No category named "<text ()<<" adding to root"; else if (items.size () > 1) qCritical () << "Multiple categories with same name found!! This is not good..."; @@ -74,23 +71,23 @@ pcl::cloud_composer::PropertiesModel::addProperty (const QString prop_name, QVar } void -pcl::cloud_composer::PropertiesModel::addCategory (const QString category_name) +pcl::cloud_composer::PropertiesModel::addCategory (const QString& category_name) { QStandardItem* new_category = new QStandardItem (category_name); appendRow (new_category); } QVariant -pcl::cloud_composer::PropertiesModel::getProperty (const QString prop_name) const +pcl::cloud_composer::PropertiesModel::getProperty (const QString& prop_name) const { //qDebug () << "Searching for property " << prop_name; QList items = findItems (prop_name, Qt::MatchExactly | Qt::MatchRecursive, 0); - if (items.size () == 0) + if (items.empty ()) { qWarning () << "No property named "<text (); return QVariant (); } - else if (items.size () > 1) + if (items.size () > 1) { qWarning () << "Multiple properties found with name "<text (); } @@ -100,7 +97,7 @@ pcl::cloud_composer::PropertiesModel::getProperty (const QString prop_name) cons // qDebug () << "Prop name="<propertyChanged (); - + parent_item_->propertyChanged (); } - diff --git a/apps/cloud_composer/src/signal_multiplexer.cpp b/apps/cloud_composer/src/signal_multiplexer.cpp index a70d49dd..be0506b6 100644 --- a/apps/cloud_composer/src/signal_multiplexer.cpp +++ b/apps/cloud_composer/src/signal_multiplexer.cpp @@ -109,12 +109,11 @@ pcl::cloud_composer::SignalMultiplexer::setCurrentObject (QObject* newObject) if (newObject == object) return; - QList::ConstIterator it; - for (it = connections.begin (); it != connections.end (); ++it) - disconnect (*it); + for (const auto &connection : connections) + disconnect (connection); object = newObject; - for (it = connections.begin (); it != connections.end (); ++it) - connect (*it); + for (const auto &connection : connections) + connect (connection); ProjectModel* model = dynamic_cast (newObject); if (model) @@ -122,4 +121,4 @@ pcl::cloud_composer::SignalMultiplexer::setCurrentObject (QObject* newObject) //let the world know about who's on top now emit currentObjectChanged (object); -} \ No newline at end of file +} diff --git a/apps/cloud_composer/src/toolbox_model.cpp b/apps/cloud_composer/src/toolbox_model.cpp index d451f073..b6141fac 100644 --- a/apps/cloud_composer/src/toolbox_model.cpp +++ b/apps/cloud_composer/src/toolbox_model.cpp @@ -1,25 +1,23 @@ -#include #include #include #include #include #include +#include +#include + pcl::cloud_composer::ToolBoxModel::ToolBoxModel (QTreeView* tool_view, QTreeView* parameter_view_, QObject* parent) : QStandardItemModel (parent) , tool_view_ (tool_view) , parameter_view_ (parameter_view_) -, project_model_ (0) +, project_model_ (nullptr) { } pcl::cloud_composer::ToolBoxModel::ToolBoxModel (const ToolBoxModel&) - : QStandardItemModel () -{ -} - -pcl::cloud_composer::ToolBoxModel::~ToolBoxModel () +: QStandardItemModel () { } @@ -40,8 +38,7 @@ pcl::cloud_composer::ToolBoxModel::addTool (ToolFactory* tool_factory) group_item->appendRow (new_tool_item); //Expand the view for this tool group QModelIndex group_index = this->indexFromItem(group_item); - tool_view_->setExpanded (group_index, true); - + tool_view_->setExpanded (group_index, true); } void @@ -51,10 +48,10 @@ pcl::cloud_composer::ToolBoxModel::setSelectionModel (QItemSelectionModel* selec } QStandardItem* -pcl::cloud_composer::ToolBoxModel::addToolGroup (QString tool_group_name) +pcl::cloud_composer::ToolBoxModel::addToolGroup (const QString& tool_group_name) { QList matches_name = findItems (tool_group_name); - if (matches_name.size () == 0) + if (matches_name.empty ()) { QStandardItem* new_group_item = new QStandardItem (tool_group_name); appendRow (new_group_item); @@ -63,7 +60,7 @@ pcl::cloud_composer::ToolBoxModel::addToolGroup (QString tool_group_name) return new_group_item; } - else if (matches_name.size () > 1) + if (matches_name.size () > 1) { qWarning () << "Multiple tool groups with same name in ToolBoxModel!!"; } @@ -152,7 +149,7 @@ pcl::cloud_composer::ToolBoxModel::modelChanged () updateEnabledTools (project_model_->getSelectionModel ()->selection ()); } void -pcl::cloud_composer::ToolBoxModel::updateEnabledTools (const QItemSelection current_selection) +pcl::cloud_composer::ToolBoxModel::updateEnabledTools (const QItemSelection& current_selection) { //qDebug () << "UPDATING ENABLED TOOLS!"; QModelIndexList current_indices = current_selection.indexes (); @@ -166,7 +163,7 @@ pcl::cloud_composer::ToolBoxModel::updateEnabledTools (const QItemSelection curr } } enableAllTools (); - QList enabled_tools = tool_items.toList (); + QList enabled_tools = tool_items.values (); QMap disabled_tools; QMutableListIterator enabled_itr(enabled_tools); //Go through tools, removing from enabled list if they fail to pass tests @@ -189,7 +186,7 @@ pcl::cloud_composer::ToolBoxModel::updateEnabledTools (const QItemSelection curr disabled_tools.insert (tool_item, tr("Tool Requires item type %1 selected").arg (ITEM_TYPES_STRINGS.value (input_type - QStandardItem::UserType))); } //Check if any of selected items have required children - else if ( required_children_types.size () > 0) + else if ( !required_children_types.empty ()) { QList matching_selected_items = type_items_map.values (input_type); bool found_valid_items = false; diff --git a/apps/cloud_composer/src/transform_clouds.cpp b/apps/cloud_composer/src/transform_clouds.cpp index 22c2197b..78da15ff 100644 --- a/apps/cloud_composer/src/transform_clouds.cpp +++ b/apps/cloud_composer/src/transform_clouds.cpp @@ -7,8 +7,8 @@ #include pcl::cloud_composer::TransformClouds::TransformClouds (QMap > transform_map, QObject* parent) - : ModifyItemTool (0, parent) - , transform_map_ (transform_map) + : ModifyItemTool (nullptr, parent) + , transform_map_ (std::move(transform_map)) { } @@ -23,7 +23,7 @@ pcl::cloud_composer::TransformClouds::performAction (ConstItemList input_data, P { if (type != PointTypeFlags::NONE) { - switch ((uint8_t) type) + switch ((std::uint8_t) type) { case (PointTypeFlags::XYZ): return this->performTemplatedAction (input_data); @@ -39,4 +39,4 @@ pcl::cloud_composer::TransformClouds::performAction (ConstItemList input_data, P qCritical () << "Transform requires templated types!"; return output; -} \ No newline at end of file +} diff --git a/apps/cloud_composer/src/work_queue.cpp b/apps/cloud_composer/src/work_queue.cpp index a05c481a..82826016 100644 --- a/apps/cloud_composer/src/work_queue.cpp +++ b/apps/cloud_composer/src/work_queue.cpp @@ -1,4 +1,3 @@ -#include #include #include @@ -22,7 +21,7 @@ pcl::cloud_composer::WorkQueue::enqueueNewAction (AbstractTool* new_tool, ConstI { ActionPair new_action; //Create a command which will manage data for the tool - new_action.command = new_tool->createCommand (input_data); + new_action.command = new_tool->createCommand (std::move(input_data)); new_action.tool = new_tool; work_queue_.enqueue (new_action); diff --git a/apps/cloud_composer/tools/euclidean_clustering.cpp b/apps/cloud_composer/tools/euclidean_clustering.cpp index 9583b1d2..c54a9c3c 100644 --- a/apps/cloud_composer/tools/euclidean_clustering.cpp +++ b/apps/cloud_composer/tools/euclidean_clustering.cpp @@ -6,11 +6,7 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_euclidean_clustering_tool, pcl::cloud_composer::EuclideanClusteringToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::EuclideanClusteringTool::EuclideanClusteringTool (PropertiesModel* parameter_model, QObject* parent) : SplitItemTool (parameter_model, parent) @@ -29,12 +25,12 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction (ConstItemList input QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in Euclidean Clustering Tool!"; return output; } - else if ( input_data.size () > 1) + if ( input_data.size () > 1) { qWarning () << "Input vector has more than one item in Euclidean Clustering!"; } @@ -99,7 +95,7 @@ pcl::cloud_composer::EuclideanClusteringTool::performAction (ConstItemList input } //We copy input cloud over for special case that no clusters found, since ExtractIndices doesn't work for 0 length vectors pcl::PCLPointCloud2::Ptr remainder_cloud (new pcl::PCLPointCloud2(*input_cloud)); - if (cluster_indices.size () > 0) + if (!cluster_indices.empty ()) { //make a cloud containing all the remaining points filter.setIndices (extracted_indices); diff --git a/apps/cloud_composer/tools/fpfh_estimation.cpp b/apps/cloud_composer/tools/fpfh_estimation.cpp index e75349f5..c46407ea 100644 --- a/apps/cloud_composer/tools/fpfh_estimation.cpp +++ b/apps/cloud_composer/tools/fpfh_estimation.cpp @@ -7,12 +7,7 @@ #include #include - -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_fpfh_estimation_tool, pcl::cloud_composer::FPFHEstimationToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::FPFHEstimationTool::FPFHEstimationTool (PropertiesModel* parameter_model, QObject* parent) : NewItemTool (parameter_model, parent) @@ -32,12 +27,12 @@ pcl::cloud_composer::FPFHEstimationTool::performAction (ConstItemList input_data QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in FPFH Estimation Tool!"; return output; } - else if ( input_data.size () > 1) + if ( input_data.size () > 1) { qWarning () << "Input vector has more than one item in FPFH Estimation!"; } @@ -48,7 +43,7 @@ pcl::cloud_composer::FPFHEstimationTool::performAction (ConstItemList input_data { //Check if this cloud has normals computed! QList normals_list = input_item->getChildren (CloudComposerItem::NORMALS_ITEM); - if ( normals_list.size () == 0 ) + if ( normals_list.empty () ) { qCritical () << "No normals item child found in this cloud item"; return output; diff --git a/apps/cloud_composer/tools/normal_estimation.cpp b/apps/cloud_composer/tools/normal_estimation.cpp index e0e7802d..4c1e232e 100644 --- a/apps/cloud_composer/tools/normal_estimation.cpp +++ b/apps/cloud_composer/tools/normal_estimation.cpp @@ -4,11 +4,7 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_normal_estimation_tool, pcl::cloud_composer::NormalEstimationToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::NormalEstimationTool::NormalEstimationTool (PropertiesModel* parameter_model, QObject* parent) : NewItemTool (parameter_model, parent) @@ -28,12 +24,12 @@ pcl::cloud_composer::NormalEstimationTool::performAction (ConstItemList input_da QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in Normal Estimation Tool!"; return output; } - else if ( input_data.size () > 1) + if ( input_data.size () > 1) { qWarning () << "Input vector has more than one item in Normal Estimation!"; } diff --git a/apps/cloud_composer/tools/organized_segmentation.cpp b/apps/cloud_composer/tools/organized_segmentation.cpp index a374e75d..2f8330e2 100644 --- a/apps/cloud_composer/tools/organized_segmentation.cpp +++ b/apps/cloud_composer/tools/organized_segmentation.cpp @@ -9,11 +9,7 @@ #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_organized_segmentation_tool, pcl::cloud_composer::OrganizedSegmentationToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::OrganizedSegmentationTool::OrganizedSegmentationTool (PropertiesModel* parameter_model, QObject* parent) : SplitItemTool (parameter_model, parent) @@ -31,7 +27,7 @@ pcl::cloud_composer::OrganizedSegmentationTool::performAction (ConstItemList inp { if (type != PointTypeFlags::NONE) { - switch ((uint8_t) type) + switch ((std::uint8_t) type) { case (PointTypeFlags::XYZ): return this->performTemplatedAction (input_data); diff --git a/apps/cloud_composer/tools/sanitize_cloud.cpp b/apps/cloud_composer/tools/sanitize_cloud.cpp index a7886cd3..f606ff4f 100644 --- a/apps/cloud_composer/tools/sanitize_cloud.cpp +++ b/apps/cloud_composer/tools/sanitize_cloud.cpp @@ -2,12 +2,7 @@ #include #include - -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_sanitize_cloud_tool, pcl::cloud_composer::SanitizeCloudToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::SanitizeCloudTool::SanitizeCloudTool (PropertiesModel* parameter_model, QObject* parent) : ModifyItemTool (parameter_model, parent) @@ -27,7 +22,7 @@ pcl::cloud_composer::SanitizeCloudTool::performAction (ConstItemList input_data, QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in SanitizeCloudTool!"; return output; diff --git a/apps/cloud_composer/tools/statistical_outlier_removal.cpp b/apps/cloud_composer/tools/statistical_outlier_removal.cpp index 6563132a..95ae8917 100644 --- a/apps/cloud_composer/tools/statistical_outlier_removal.cpp +++ b/apps/cloud_composer/tools/statistical_outlier_removal.cpp @@ -4,11 +4,7 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_statistical_outlier_removal_tool, pcl::cloud_composer::StatisticalOutlierRemovalToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::StatisticalOutlierRemovalTool::StatisticalOutlierRemovalTool (PropertiesModel* parameter_model, QObject* parent) : ModifyItemTool (parameter_model, parent) @@ -28,12 +24,12 @@ pcl::cloud_composer::StatisticalOutlierRemovalTool::performAction (ConstItemList QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in StatisticalOutlierRemovalTool!"; return output; } - else if ( input_data.size () > 1) + if ( input_data.size () > 1) { qWarning () << "Input vector has more than one item in StatisticalOutlierRemovalTool"; } diff --git a/apps/cloud_composer/tools/supervoxels.cpp b/apps/cloud_composer/tools/supervoxels.cpp index e0b77633..6b9be7f5 100644 --- a/apps/cloud_composer/tools/supervoxels.cpp +++ b/apps/cloud_composer/tools/supervoxels.cpp @@ -7,11 +7,7 @@ #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_voxel_superpixels_tool, pcl::cloud_composer::SupervoxelsToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::SupervoxelsTool::SupervoxelsTool (PropertiesModel* parameter_model, QObject* parent) : SplitItemTool (parameter_model, parent) @@ -29,7 +25,7 @@ pcl::cloud_composer::SupervoxelsTool::performAction (ConstItemList input_data, P { if (type != PointTypeFlags::NONE) { - switch ((uint8_t) type) + switch ((std::uint8_t) type) { case (PointTypeFlags::XYZ | PointTypeFlags::RGB): return this->performTemplatedAction (input_data); @@ -45,8 +41,8 @@ pcl::cloud_composer::SupervoxelsTool::performAction (ConstItemList input_data, P return output; } -template QList pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (QList ); -//template QList pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (QList ); +template QList pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (const QList &); +//template QList pcl::cloud_composer::SupervoxelsTool::performTemplatedAction (const QList &); /////////////////// PARAMETER MODEL ///////////////////////////////// diff --git a/apps/cloud_composer/tools/voxel_grid_downsample.cpp b/apps/cloud_composer/tools/voxel_grid_downsample.cpp index 0e81f535..d6efb21c 100644 --- a/apps/cloud_composer/tools/voxel_grid_downsample.cpp +++ b/apps/cloud_composer/tools/voxel_grid_downsample.cpp @@ -5,11 +5,7 @@ #include -#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) - Q_EXPORT_PLUGIN2(cloud_composer_voxel_grid_downsample_tool, pcl::cloud_composer::VoxelGridDownsampleToolFactory) -#else - Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") -#endif +Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::VoxelGridDownsampleTool::VoxelGridDownsampleTool (PropertiesModel* parameter_model, QObject* parent) : ModifyItemTool (parameter_model, parent) @@ -29,12 +25,12 @@ pcl::cloud_composer::VoxelGridDownsampleTool::performAction (ConstItemList input QList output; const CloudComposerItem* input_item; // Check input data length - if ( input_data.size () == 0) + if ( input_data.empty ()) { qCritical () << "Empty input in VoxelGridDownsampleTool!"; return output; } - else if ( input_data.size () > 1) + if ( input_data.size () > 1) { qWarning () << "Input vector has more than one item in VoxelGridDownsampleTool"; } diff --git a/apps/in_hand_scanner/CMakeLists.txt b/apps/in_hand_scanner/CMakeLists.txt index 5f9e86a3..4cb19e77 100644 --- a/apps/in_hand_scanner/CMakeLists.txt +++ b/apps/in_hand_scanner/CMakeLists.txt @@ -4,13 +4,13 @@ set(SUBSUBSYS_DEPS common features io kdtree apps) set(SUBSUBSYS_LIBS pcl_common pcl_features pcl_io pcl_kdtree) ################################################################################ -# Qt -if(NOT QT4_FOUND) +# QT5 Found? +if(NOT Qt5_FOUND) set(DEFAULT AUTO_OFF) - set(REASON "Qt4 is required for the in_hand_scanner app!") -else() - set(DEFAULT TRUE) - set(REASON) + set(REASON "Qt5 was not found.") +elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") + set(DEFAULT TRUE) + set(REASON) endif() # OpenGL @@ -18,58 +18,58 @@ if(NOT OPENGL_FOUND AND NOT OPENGL_GLU_FOUND) set(DEFAULT AUTO_OFF) set(REASON "OpenGL & GLU are required for the in_hand_scanner app!") elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT TRUE) - set(REASON) + set(DEFAULT TRUE) + set(REASON) endif() #OpenNI if(NOT WITH_OPENNI) - set(DEFAULT AUTO_OFF) - set(REASON "OpenNI was not found or was disabled by the user.") + set(DEFAULT AUTO_OFF) + set(REASON "OpenNI was not found or was disabled by the user.") elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT TRUE) - set(REASON) + set(DEFAULT TRUE) + set(REASON) endif() # Default to not building for now -if (${DEFAULT} STREQUAL "TRUE") +if(${DEFAULT} STREQUAL "TRUE") set(DEFAULT FALSE) endif() pcl_subsubsys_option(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") -pcl_subsubsys_depend(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSYS_DEPS} EXT_DEPS Qt4 OpenGL OpenGL_GLU openni) +pcl_subsubsys_depend(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSYS_DEPS} EXT_DEPS Qt5 OpenGL OpenGL_GLU openni) pcl_add_doc("${SUBSUBSYS_NAME}") ################################################################################ set(INCS - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/boost.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/common_types.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/eigen.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/icp.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/input_data_processing.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/integration.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/mesh_processing.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/visibility_confidence.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/boost.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/common_types.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/eigen.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/icp.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/input_data_processing.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/integration.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/mesh_processing.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/utils.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/visibility_confidence.h" ) set(IMPL_INCS - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/common_types.hpp" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/common_types.hpp" ) set(SRCS - src/help_window.cpp - src/main.cpp - src/main_window.cpp - src/icp.cpp - src/in_hand_scanner.cpp - src/input_data_processing.cpp - src/integration.cpp - src/mesh_processing.cpp - src/opengl_viewer.cpp - src/visibility_confidence.cpp + src/help_window.cpp + src/main.cpp + src/main_window.cpp + src/icp.cpp + src/in_hand_scanner.cpp + src/input_data_processing.cpp + src/integration.cpp + src/mesh_processing.cpp + src/opengl_viewer.cpp + src/visibility_confidence.cpp ) # Qt @@ -84,57 +84,55 @@ set(UI_HELP_WINDOW src/help_window.ui) # Offline integration set(OI_INCS - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/integration.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/visibility_confidence.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/integration.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/visibility_confidence.h" ) set(OI_SRCS - src/main_offline_integration.cpp - src/integration.cpp - src/offline_integration.cpp - src/opengl_viewer.cpp - src/visibility_confidence.cpp + src/main_offline_integration.cpp + src/integration.cpp + src/offline_integration.cpp + src/opengl_viewer.cpp + src/visibility_confidence.cpp ) ################################################################################ -if(build) +if(NOT build) + return() +endif() - # Qt - # http://qtnode.net/wiki/Qt4_with_cmake - # http://qt-project.org/quarterly/view/using_cmake_to_build_qt_projects - set(QT_USE_QTOPENGL TRUE) - include("${QT_USE_FILE}") - qt4_wrap_cpp(MOC_IN_HAND_SCANNER_SRC "${MOC_IN_HAND_SCANNER_INC}") - qt4_wrap_cpp(MOC_OPENGL_VIEWER_SRC "${MOC_OPENGL_VIEWER_INC}" OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - qt4_wrap_cpp(MOC_OFFLINE_INTEGRATION_SRC "${MOC_OFFLINE_INTEGRATION_INC}" OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +qt5_wrap_cpp(MOC_IN_HAND_SCANNER_SRC "${MOC_IN_HAND_SCANNER_INC}") +qt5_wrap_cpp(MOC_OPENGL_VIEWER_SRC "${MOC_OPENGL_VIEWER_INC}" OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +qt5_wrap_cpp(MOC_OFFLINE_INTEGRATION_SRC "${MOC_OFFLINE_INTEGRATION_INC}" OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - qt4_wrap_cpp(MOC_MAIN_WINDOW_SRC "${MOC_MAIN_WINDOW_INC}") - qt4_wrap_cpp(MOC_HELP_WINDOW_SRC "${MOC_HELP_WINDOW_INC}") - qt4_wrap_ui(UI_MAIN_WINDOW_INC "${UI_MAIN_WINDOW}") - qt4_wrap_ui(UI_HELP_WINDOW_INC "${UI_HELP_WINDOW}") +qt5_wrap_cpp(MOC_MAIN_WINDOW_SRC "${MOC_MAIN_WINDOW_INC}") +qt5_wrap_cpp(MOC_HELP_WINDOW_SRC "${MOC_HELP_WINDOW_INC}") +qt5_wrap_ui(UI_MAIN_WINDOW_INC "${UI_MAIN_WINDOW}") +qt5_wrap_ui(UI_HELP_WINDOW_INC "${UI_HELP_WINDOW}") - list(APPEND ADDITIONAL_LIBS ${QT_LIBRARIES}) - include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") +include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") - # In-hand scanner - list(APPEND INCS "${MOC_IN_HAND_SCANNER_INC}" "${MOC_OPENGL_VIEWER_INC}" "${MOC_MAIN_WINDOW_INC}" "${MOC_HELP_WINDOW_INC}" "${UI_MAIN_WINDOW_INC}" "${UI_HELP_WINDOW_INC}") - list(APPEND SRCS "${MOC_IN_HAND_SCANNER_SRC}" "${MOC_OPENGL_VIEWER_SRC}" "${MOC_MAIN_WINDOW_SRC}" "${MOC_HELP_WINDOW_SRC}") +# In-hand scanner +list(APPEND INCS "${MOC_IN_HAND_SCANNER_INC}" "${MOC_OPENGL_VIEWER_INC}" "${MOC_MAIN_WINDOW_INC}" "${MOC_HELP_WINDOW_INC}" "${UI_MAIN_WINDOW_INC}" "${UI_HELP_WINDOW_INC}") +list(APPEND SRCS "${MOC_IN_HAND_SCANNER_SRC}" "${MOC_OPENGL_VIEWER_SRC}" "${MOC_MAIN_WINDOW_SRC}" "${MOC_HELP_WINDOW_SRC}") - set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") - pcl_add_executable_opt_bundle("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${SRCS} ${INCS} ${IMPL_INCS}) - target_link_libraries("${EXE_NAME}" ${SUBSUBSYS_LIBS} ${OPENGL_LIBRARIES} ${QT_LIBRARIES}) +set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") +PCL_ADD_EXECUTABLE(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} SOURCES ${SRCS} ${INCS} ${IMPL_INCS} BUNDLE) +target_link_libraries("${EXE_NAME}" ${SUBSUBSYS_LIBS} ${OPENGL_LIBRARIES} Qt5::Concurrent Qt5::Widgets Qt5::OpenGL) - pcl_add_includes("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${INCS}) - pcl_add_includes("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${IMPL_INCS}) +pcl_add_includes("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${INCS}) +pcl_add_includes("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${IMPL_INCS}) - pcl_make_pkgconfig("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "") +PCL_MAKE_PKGCONFIG(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} DESC ${SUBSUBSYS_DESC}) - # Offline integration - list(APPEND OI_INCS "${MOC_OPENGL_VIEWER_INC}" "${MOC_OFFLINE_INTEGRATION_INC}") - list(APPEND OI_SRCS "${MOC_OPENGL_VIEWER_SRC}" "${MOC_OFFLINE_INTEGRATION_SRC}") +# Offline integration +list(APPEND OI_INCS "${MOC_OPENGL_VIEWER_INC}" "${MOC_OFFLINE_INTEGRATION_INC}") +list(APPEND OI_SRCS "${MOC_OPENGL_VIEWER_SRC}" "${MOC_OFFLINE_INTEGRATION_SRC}") - pcl_add_executable_opt_bundle(pcl_offline_integration "${SUBSUBSYS_NAME}" ${OI_SRCS} ${OI_INCS}) - target_link_libraries(pcl_offline_integration ${SUBSUBSYS_LIBS} ${OPENGL_LIBRARIES} ${QT_LIBRARIES}) +PCL_ADD_EXECUTABLE(pcl_offline_integration COMPONENT ${SUBSUBSYS_NAME} SOURCES ${OI_SRCS} ${OI_INCS} BUNDLE) +target_link_libraries(pcl_offline_integration ${SUBSUBSYS_LIBS} ${OPENGL_LIBRARIES} Qt5::Concurrent Qt5::Widgets Qt5::OpenGL) -endif() +# Add to the compound apps target +list(APPEND PCL_APPS_ALL_TARGETS ${PCL_IN_HAND_SCANNER_ALL_TARGETS}) +set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE) diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h index 8314cd0a..5575dccb 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h @@ -38,22 +38,11 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_BOOST_H -#define PCL_APPS_IN_HAND_SCANNER_BOOST_H +#pragma once #ifdef __GNUC__ # pragma GCC system_header #endif -#include -#include -#include #include -#include #include -//#include -#include -#include -#include - -#endif // PCL_APPS_IN_HAND_SCANNER_BOOST_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/common_types.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/common_types.h index 1dbb5208..f963aa9a 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/common_types.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/common_types.h @@ -38,10 +38,9 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_COMMON_TYPES_H -#define PCL_APPS_IN_HAND_SCANNER_COMMON_TYPES_H +#pragma once -#include +#include #include #include @@ -52,9 +51,9 @@ namespace pcl namespace ihs { struct PointIHS; - typedef pcl::PointCloud CloudIHS; - typedef CloudIHS::Ptr CloudIHSPtr; - typedef CloudIHS::ConstPtr CloudIHSConstPtr; + using CloudIHS = pcl::PointCloud; + using CloudIHSPtr = CloudIHS::Ptr; + using CloudIHSConstPtr = CloudIHS::ConstPtr; } // End namespace ihs } // End namespace pcl @@ -70,7 +69,7 @@ POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ihs::_PointIHS, (float, rgb, rgb) (float, weight, weight) (unsigned int, age, age) - (uint32_t, directions, directions) + (std::uint32_t, directions, directions) ) POINT_CLOUD_REGISTER_POINT_WRAPPER (pcl::ihs::PointIHS, pcl::ihs::_PointIHS) @@ -80,18 +79,16 @@ namespace pcl { struct MeshTraits { - typedef PointIHS VertexData; - typedef pcl::geometry::NoData HalfEdgeData; - typedef pcl::geometry::NoData EdgeData; - typedef pcl::geometry::NoData FaceData; - typedef boost::true_type IsManifold; + using VertexData = PointIHS; + using HalfEdgeData = pcl::geometry::NoData; + using EdgeData = pcl::geometry::NoData; + using FaceData = pcl::geometry::NoData; + using IsManifold = std::true_type; }; // NOTE: The drawMesh method in pcl::ihs::InHandScanner only supports triangles! - typedef pcl::geometry::TriangleMesh Mesh; - typedef Mesh::Ptr MeshPtr; - typedef Mesh::ConstPtr MeshConstPtr; + using Mesh = pcl::geometry::TriangleMesh; + using MeshPtr = Mesh::Ptr; + using MeshConstPtr = Mesh::ConstPtr; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_COMMON_TYPES_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/eigen.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/eigen.h index 9b42bede..7c1208e3 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/eigen.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/eigen.h @@ -38,8 +38,7 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_EIGEN_H -#define PCL_APPS_IN_HAND_SCANNER_EIGEN_H +#pragma once #ifdef __GNUC__ # pragma GCC system_header @@ -48,5 +47,3 @@ #include #include #include - -#endif // PCL_APPS_IN_HAND_SCANNER_EIGEN_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/help_window.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/help_window.h index 95254263..abfdbd89 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/help_window.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/help_window.h @@ -38,9 +38,7 @@ * */ - -#ifndef PCL_APPS_IN_HAND_SCANNER_HELP_WINDOW_H -#define PCL_APPS_IN_HAND_SCANNER_HELP_WINDOW_H +#pragma once #include @@ -58,7 +56,7 @@ namespace pcl Q_OBJECT public: - explicit HelpWindow (QWidget* parent = 0); + explicit HelpWindow (QWidget* parent = nullptr); ~HelpWindow (); private: @@ -66,5 +64,3 @@ namespace pcl }; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_HELP_WINDOW_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h index e5db6c12..46991846 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/icp.h @@ -38,23 +38,13 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_ICP_H -#define PCL_APPS_IN_HAND_SCANNER_ICP_H +#pragma once #include #include #include #include - -//////////////////////////////////////////////////////////////////////////////// -// Forward declarations -//////////////////////////////////////////////////////////////////////////////// - -namespace pcl -{ - template - class KdTree; -} // End namespace pcl +#include //////////////////////////////////////////////////////////////////////////////// // ICP @@ -72,14 +62,14 @@ namespace pcl { public: - typedef pcl::PointXYZRGBNormal PointXYZRGBNormal; - typedef pcl::PointCloud CloudXYZRGBNormal; - typedef CloudXYZRGBNormal::Ptr CloudXYZRGBNormalPtr; - typedef CloudXYZRGBNormal::ConstPtr CloudXYZRGBNormalConstPtr; + using PointXYZRGBNormal = pcl::PointXYZRGBNormal; + using CloudXYZRGBNormal = pcl::PointCloud; + using CloudXYZRGBNormalPtr = CloudXYZRGBNormal::Ptr; + using CloudXYZRGBNormalConstPtr = CloudXYZRGBNormal::ConstPtr; - typedef pcl::ihs::Mesh Mesh; - typedef pcl::ihs::MeshPtr MeshPtr; - typedef pcl::ihs::MeshConstPtr MeshConstPtr; + using Mesh = pcl::ihs::Mesh; + using MeshPtr = pcl::ihs::MeshPtr; + using MeshConstPtr = pcl::ihs::MeshConstPtr; /** \brief Constructor */ ICP (); @@ -165,14 +155,14 @@ namespace pcl private: - typedef pcl::PointNormal PointNormal; - typedef pcl::PointCloud CloudNormal; - typedef CloudNormal::Ptr CloudNormalPtr; - typedef CloudNormal::ConstPtr CloudNormalConstPtr; + using PointNormal = pcl::PointNormal; + using CloudNormal = pcl::PointCloud; + using CloudNormalPtr = CloudNormal::Ptr; + using CloudNormalConstPtr = CloudNormal::ConstPtr; - typedef pcl::KdTree KdTree; - typedef boost::shared_ptr KdTreePtr; - typedef boost::shared_ptr KdTreeConstPtr; + using KdTree = pcl::KdTree; + using KdTreePtr = KdTree::Ptr; + using KdTreeConstPtr = KdTree::ConstPtr; /** \brief Selects the model points that are pointing towards to the camera (data coordinate system = camera coordinate system). * \param[in] mesh_model Input mesh. @@ -221,5 +211,3 @@ namespace pcl }; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_ICP_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp index 1dab37ac..63d5d06d 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/impl/common_types.hpp @@ -43,6 +43,8 @@ #include +#include + namespace pcl { namespace ihs @@ -52,11 +54,11 @@ namespace pcl PCL_ADD_POINT4D PCL_ADD_NORMAL4D PCL_ADD_RGB - float weight; + float weight; unsigned int age; - uint32_t directions; + std::uint32_t directions; - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW }; struct PointIHS : public pcl::ihs::_PointIHS diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h index ef09cad4..0999e1ac 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/in_hand_scanner.h @@ -38,18 +38,19 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_IN_HAND_SCANNER_H -#define PCL_APPS_IN_HAND_SCANNER_IN_HAND_SCANNER_H - -#include -#include -#include +#pragma once #include +#include #include #include #include +#include +#include +#include +#include + //////////////////////////////////////////////////////////////////////////////// // Forward declarations //////////////////////////////////////////////////////////////////////////////// @@ -84,44 +85,44 @@ namespace pcl public: - typedef pcl::ihs::OpenGLViewer Base; - typedef pcl::ihs::InHandScanner Self; + using Base = pcl::ihs::OpenGLViewer; + using Self = pcl::ihs::InHandScanner; - typedef pcl::ihs::InputDataProcessing InputDataProcessing; - typedef boost::shared_ptr InputDataProcessingPtr; - typedef boost::shared_ptr InputDataProcessingConstPtr; + using InputDataProcessing = pcl::ihs::InputDataProcessing; + using InputDataProcessingPtr = std::shared_ptr; + using InputDataProcessingConstPtr = std::shared_ptr; - typedef pcl::ihs::ICP ICP; - typedef boost::shared_ptr ICPPtr; - typedef boost::shared_ptr ICPConstPtr; + using ICP = pcl::ihs::ICP; + using ICPPtr = std::shared_ptr; + using ICPConstPtr = std::shared_ptr; - typedef pcl::ihs::Integration Integration; - typedef boost::shared_ptr IntegrationPtr; - typedef boost::shared_ptr IntegrationConstPtr; + using Integration = pcl::ihs::Integration; + using IntegrationPtr = std::shared_ptr; + using IntegrationConstPtr = std::shared_ptr; - typedef pcl::ihs::MeshProcessing MeshProcessing; - typedef boost::shared_ptr MeshProcessingPtr; - typedef boost::shared_ptr MeshProcessingConstPtr; + using MeshProcessing = pcl::ihs::MeshProcessing; + using MeshProcessingPtr = std::shared_ptr; + using MeshProcessingConstPtr = std::shared_ptr; /** \brief Switch between different branches of the scanning pipeline. */ - typedef enum RunningMode + enum RunningMode { RM_SHOW_MODEL = 0, /**< Shows the model shape (if it is available). */ RM_UNPROCESSED = 1, /**< Shows the unprocessed input data. */ RM_PROCESSED = 2, /**< Shows the processed input data. */ RM_REGISTRATION_CONT = 3, /**< Registers new data to the first acquired data continuously. */ RM_REGISTRATION_SINGLE = 4 /**< Registers new data once and returns to showing the processed data. */ - } RunningMode; + }; /** \brief File type for saving and loading files. */ - typedef enum FileType + enum FileType { FT_PLY = 0, /**< Polygon File Format. */ FT_VTK = 1 /**< VTK File Format. */ - } FileType; + }; /** \brief Constructor. */ - explicit InHandScanner (Base* parent=0); + explicit InHandScanner (Base* parent=nullptr); /** \brief Destructor. */ ~InHandScanner (); @@ -186,38 +187,38 @@ namespace pcl /** \see http://doc.qt.digia.com/qt/qwidget.html#keyPressEvent */ void - keyPressEvent (QKeyEvent* event); + keyPressEvent (QKeyEvent* event) override; private: - typedef pcl::PointXYZRGBA PointXYZRGBA; - typedef pcl::PointCloud CloudXYZRGBA; - typedef CloudXYZRGBA::Ptr CloudXYZRGBAPtr; - typedef CloudXYZRGBA::ConstPtr CloudXYZRGBAConstPtr; + using PointXYZRGBA = pcl::PointXYZRGBA; + using CloudXYZRGBA = pcl::PointCloud; + using CloudXYZRGBAPtr = CloudXYZRGBA::Ptr; + using CloudXYZRGBAConstPtr = CloudXYZRGBA::ConstPtr; - typedef pcl::PointXYZRGBNormal PointXYZRGBNormal; - typedef pcl::PointCloud CloudXYZRGBNormal; - typedef CloudXYZRGBNormal::Ptr CloudXYZRGBNormalPtr; - typedef CloudXYZRGBNormal::ConstPtr CloudXYZRGBNormalConstPtr; + using PointXYZRGBNormal = pcl::PointXYZRGBNormal; + using CloudXYZRGBNormal = pcl::PointCloud; + using CloudXYZRGBNormalPtr = CloudXYZRGBNormal::Ptr; + using CloudXYZRGBNormalConstPtr = CloudXYZRGBNormal::ConstPtr; - typedef pcl::ihs::PointIHS PointIHS; - typedef pcl::ihs::CloudIHS CloudIHS; - typedef pcl::ihs::CloudIHSPtr CloudIHSPtr; - typedef pcl::ihs::CloudIHSConstPtr CloudIHSConstPtr; + using PointIHS = pcl::ihs::PointIHS; + using CloudIHS = pcl::ihs::CloudIHS; + using CloudIHSPtr = pcl::ihs::CloudIHSPtr; + using CloudIHSConstPtr = pcl::ihs::CloudIHSConstPtr; - typedef pcl::ihs::Mesh Mesh; - typedef pcl::ihs::MeshPtr MeshPtr; - typedef pcl::ihs::MeshConstPtr MeshConstPtr; + using Mesh = pcl::ihs::Mesh; + using MeshPtr = pcl::ihs::MeshPtr; + using MeshConstPtr = pcl::ihs::MeshConstPtr; - typedef pcl::OpenNIGrabber Grabber; - typedef boost::shared_ptr GrabberPtr; - typedef boost::shared_ptr GrabberConstPtr; + using Grabber = pcl::OpenNIGrabber; + using GrabberPtr = std::shared_ptr; + using GrabberConstPtr = std::shared_ptr; /** \brief Helper object for the computation thread. Please have a look at the documentation of calcFPS. */ class ComputationFPS : public Base::FPS { public: - ComputationFPS () : Base::FPS () {} + ComputationFPS () {} ~ComputationFPS () {} }; @@ -225,7 +226,7 @@ namespace pcl class VisualizationFPS : public Base::FPS { public: - VisualizationFPS () : Base::FPS () {} + VisualizationFPS () {} ~VisualizationFPS () {} }; @@ -237,7 +238,7 @@ namespace pcl * \see http://doc.qt.digia.com/qt/opengl-overpainting.html */ void - paintEvent (QPaintEvent* event); + paintEvent (QPaintEvent* event) override; /** \brief Draw text over the opengl scene. * \see http://doc.qt.digia.com/qt/opengl-overpainting.html @@ -254,7 +255,7 @@ namespace pcl //////////////////////////////////////////////////////////////////////// /** \brief Synchronization. */ - boost::mutex mutex_; + std::mutex mutex_; /** \brief Please have a look at the documentation of ComputationFPS. */ ComputationFPS computation_fps_; @@ -299,13 +300,10 @@ namespace pcl bool destructor_called_; public: - - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW }; } // End namespace ihs } // End namespace pcl // http://doc.qt.digia.com/qt/qmetatype.html#Q_DECLARE_METATYPE Q_DECLARE_METATYPE (pcl::ihs::InHandScanner::RunningMode) - -#endif // PCL_APPS_IN_HAND_SCANNER_IN_HAND_SCANNER_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h index 3da5d329..63b9cc15 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/input_data_processing.h @@ -38,23 +38,13 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_INPUT_DATA_PROCESSING_H -#define PCL_APPS_IN_HAND_SCANNER_INPUT_DATA_PROCESSING_H +#pragma once #include #include #include #include - -//////////////////////////////////////////////////////////////////////////////// -// Forward declarations -//////////////////////////////////////////////////////////////////////////////// - -namespace pcl -{ - template - class IntegralImageNormalEstimation; -} // End namespace pcl +#include //////////////////////////////////////////////////////////////////////////////// // InputDataProcessing @@ -72,15 +62,15 @@ namespace pcl { public: - typedef pcl::PointXYZRGBA PointXYZRGBA; - typedef pcl::PointCloud CloudXYZRGBA; - typedef CloudXYZRGBA::Ptr CloudXYZRGBAPtr; - typedef CloudXYZRGBA::ConstPtr CloudXYZRGBAConstPtr; + using PointXYZRGBA = pcl::PointXYZRGBA; + using CloudXYZRGBA = pcl::PointCloud; + using CloudXYZRGBAPtr = CloudXYZRGBA::Ptr; + using CloudXYZRGBAConstPtr = CloudXYZRGBA::ConstPtr; - typedef pcl::PointXYZRGBNormal PointXYZRGBNormal; - typedef pcl::PointCloud CloudXYZRGBNormal; - typedef CloudXYZRGBNormal::Ptr CloudXYZRGBNormalPtr; - typedef CloudXYZRGBNormal::ConstPtr CloudXYZRGBNormalConstPtr; + using PointXYZRGBNormal = pcl::PointXYZRGBNormal; + using CloudXYZRGBNormal = pcl::PointCloud; + using CloudXYZRGBNormalPtr = CloudXYZRGBNormal::Ptr; + using CloudXYZRGBNormalConstPtr = CloudXYZRGBNormal::ConstPtr; /** \brief Constructor */ InputDataProcessing (); @@ -169,17 +159,17 @@ namespace pcl private: - typedef pcl::Normal Normal; - typedef pcl::PointCloud CloudNormals; - typedef boost::shared_ptr CloudNormalsPtr; - typedef boost::shared_ptr CloudNormalsConstPtr; + using Normal = pcl::Normal; + using CloudNormals = pcl::PointCloud; + using CloudNormalsPtr = CloudNormals::Ptr; + using CloudNormalsConstPtr = CloudNormals::ConstPtr; - typedef pcl::IntegralImageNormalEstimation NormalEstimation; - typedef boost::shared_ptr NormalEstimationPtr; - typedef boost::shared_ptr NormalEstimationConstPtr; + using NormalEstimation = pcl::IntegralImageNormalEstimation ; + using NormalEstimationPtr = NormalEstimation::Ptr; + using NormalEstimationConstPtr = NormalEstimation::ConstPtr; - typedef Eigen::Matrix MatrixXb; - typedef Eigen::MatrixXi MatrixXi; + using MatrixXb = Eigen::Matrix ; + using MatrixXi = Eigen::MatrixXi; /** \brief Erodes the input mask k times with a diamond shaped structuring element. * \see http://ostermiller.org/dilate_and_erode.html @@ -239,5 +229,3 @@ namespace pcl }; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_INPUT_DATA_PROCESSING_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h index f6ff2e24..2617e12c 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/integration.h @@ -38,23 +38,13 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_INTEGRATION_H -#define PCL_APPS_IN_HAND_SCANNER_INTEGRATION_H +#pragma once -#include +#include -#include #include - -//////////////////////////////////////////////////////////////////////////////// -// Forward declarations -//////////////////////////////////////////////////////////////////////////////// - -namespace pcl -{ - template - class KdTree; -} // End namespace pcl +#include +#include //////////////////////////////////////////////////////////////////////////////// // Integration @@ -72,16 +62,16 @@ namespace pcl { public: - typedef pcl::PointXYZRGBNormal PointXYZRGBNormal; - typedef pcl::PointCloud CloudXYZRGBNormal; - typedef CloudXYZRGBNormal::Ptr CloudXYZRGBNormalPtr; - typedef CloudXYZRGBNormal::ConstPtr CloudXYZRGBNormalConstPtr; + using PointXYZRGBNormal = pcl::PointXYZRGBNormal; + using CloudXYZRGBNormal = pcl::PointCloud; + using CloudXYZRGBNormalPtr = CloudXYZRGBNormal::Ptr; + using CloudXYZRGBNormalConstPtr = CloudXYZRGBNormal::ConstPtr; - typedef pcl::ihs::Mesh Mesh; - typedef pcl::ihs::MeshPtr MeshPtr; - typedef pcl::ihs::MeshConstPtr MeshConstPtr; - typedef Mesh::VertexIndex VertexIndex; - typedef Mesh::VertexIndices VertexIndices; + using Mesh = pcl::ihs::Mesh; + using MeshPtr = pcl::ihs::MeshPtr; + using MeshConstPtr = pcl::ihs::MeshConstPtr; + using VertexIndex = Mesh::VertexIndex; + using VertexIndices = Mesh::VertexIndices; /** \brief Constructor. */ Integration (); @@ -154,21 +144,21 @@ namespace pcl private: - typedef pcl::PointXYZ PointXYZ; - typedef pcl::PointCloud CloudXYZ; - typedef CloudXYZ::Ptr CloudXYZPtr; - typedef CloudXYZ::ConstPtr CloudXYZConstPtr; + using PointXYZ = pcl::PointXYZ; + using CloudXYZ = pcl::PointCloud; + using CloudXYZPtr = CloudXYZ::Ptr; + using CloudXYZConstPtr = CloudXYZ::ConstPtr; - typedef pcl::ihs::PointIHS PointIHS; - typedef pcl::ihs::CloudIHS CloudIHS; - typedef pcl::ihs::CloudIHSPtr CloudIHSPtr; - typedef pcl::ihs::CloudIHSConstPtr CloudIHSConstPtr; + using PointIHS = pcl::ihs::PointIHS; + using CloudIHS = pcl::ihs::CloudIHS; + using CloudIHSPtr = pcl::ihs::CloudIHSPtr; + using CloudIHSConstPtr = pcl::ihs::CloudIHSConstPtr; - typedef pcl::KdTree KdTree; - typedef boost::shared_ptr KdTreePtr; - typedef boost::shared_ptr KdTreeConstPtr; + using KdTree = pcl::KdTree; + using KdTreePtr = KdTree::Ptr; + using KdTreeConstPtr = KdTree::ConstPtr; - uint8_t + std::uint8_t trimRGB (const float val) const; /** \brief Adds two triangles between points 0-1-3 and 1-2-3 to the mesh. */ @@ -230,5 +220,3 @@ namespace pcl }; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_INTEGRATION_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/main_window.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/main_window.h index 61ec1757..62e496e2 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/main_window.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/main_window.h @@ -38,8 +38,7 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_MAIN_WINDOW_H -#define PCL_APPS_IN_HAND_SCANNER_MAIN_WINDOW_H +#pragma once #include @@ -76,11 +75,11 @@ namespace pcl public: - typedef pcl::ihs::InHandScanner InHandScanner; - typedef pcl::ihs::HelpWindow HelpWindow; - typedef InHandScanner::RunningMode RunningMode; + using InHandScanner = pcl::ihs::InHandScanner; + using HelpWindow = pcl::ihs::HelpWindow; + using RunningMode = InHandScanner::RunningMode; - explicit MainWindow (QWidget* parent = 0); + explicit MainWindow (QWidget* parent = nullptr); ~MainWindow (); public Q_SLOTS: @@ -90,7 +89,7 @@ namespace pcl // In hand scanner void runningModeChanged (const RunningMode mode); - void keyPressEvent (QKeyEvent* event); + void keyPressEvent (QKeyEvent* event) override; // Input data processing. void setXMin (const int x_min); @@ -136,5 +135,3 @@ namespace pcl }; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_MAIN_WINDOW_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/mesh_processing.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/mesh_processing.h index 544a07b3..69d785b3 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/mesh_processing.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/mesh_processing.h @@ -38,8 +38,7 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_MESH_PROCESSING_H -#define PCL_APPS_IN_HAND_SCANNER_MESH_PROCESSING_H +#pragma once #include @@ -55,11 +54,10 @@ namespace pcl { public: - typedef pcl::ihs::Mesh Mesh; - typedef Mesh::HalfEdgeIndices HalfEdgeIndices; + using Mesh = pcl::ihs::Mesh; + using HalfEdgeIndices = Mesh::HalfEdgeIndices; - // Currently works only on the manifold mesh. - BOOST_STATIC_ASSERT (Mesh::IsManifold::value); + static_assert (Mesh::IsManifold::value, "MeshProcessing currently works only on the manifold mesh."); /** \brief Constructor. */ MeshProcessing (); @@ -74,5 +72,3 @@ namespace pcl }; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_MESH_PROCESSING_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h index ce888322..90ccb982 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/offline_integration.h @@ -38,28 +38,27 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_OFFLINE_INTEGRATION_H -#define PCL_APPS_IN_HAND_SCANNER_OFFLINE_INTEGRATION_H - -#include -#include +#pragma once #include +#include #include +#include #include #include #include #include +#include +#include +#include + //////////////////////////////////////////////////////////////////////////////// // Forward declarations //////////////////////////////////////////////////////////////////////////////// namespace pcl { - template - class IntegralImageNormalEstimation; - namespace ihs { class Integration; @@ -83,11 +82,11 @@ namespace pcl public: - typedef pcl::ihs::OpenGLViewer Base; - typedef pcl::ihs::OfflineIntegration Self; + using Base = pcl::ihs::OpenGLViewer; + using Self = pcl::ihs::OfflineIntegration; /** \brief Constructor. */ - explicit OfflineIntegration (Base* parent=0); + explicit OfflineIntegration (Base* parent=nullptr); /** \brief Destructor. */ ~OfflineIntegration (); @@ -106,33 +105,33 @@ namespace pcl private: - typedef pcl::PointXYZRGBA PointXYZRGBA; - typedef pcl::PointCloud CloudXYZRGBA; - typedef CloudXYZRGBA::Ptr CloudXYZRGBAPtr; - typedef CloudXYZRGBA::ConstPtr CloudXYZRGBAConstPtr; + using PointXYZRGBA = pcl::PointXYZRGBA; + using CloudXYZRGBA = pcl::PointCloud; + using CloudXYZRGBAPtr = CloudXYZRGBA::Ptr; + using CloudXYZRGBAConstPtr = CloudXYZRGBA::ConstPtr; - typedef pcl::PointXYZRGBNormal PointXYZRGBNormal; - typedef pcl::PointCloud CloudXYZRGBNormal; - typedef CloudXYZRGBNormal::Ptr CloudXYZRGBNormalPtr; - typedef CloudXYZRGBNormal::ConstPtr CloudXYZRGBNormalConstPtr; + using PointXYZRGBNormal = pcl::PointXYZRGBNormal; + using CloudXYZRGBNormal = pcl::PointCloud; + using CloudXYZRGBNormalPtr = CloudXYZRGBNormal::Ptr; + using CloudXYZRGBNormalConstPtr = CloudXYZRGBNormal::ConstPtr; - typedef pcl::ihs::Mesh Mesh; - typedef pcl::ihs::MeshPtr MeshPtr; - typedef pcl::ihs::MeshConstPtr MeshConstPtr; + using Mesh = pcl::ihs::Mesh; + using MeshPtr = pcl::ihs::MeshPtr; + using MeshConstPtr = pcl::ihs::MeshConstPtr; - typedef pcl::ihs::Integration Integration; - typedef boost::shared_ptr IntegrationPtr; - typedef boost::shared_ptr IntegrationConstPtr; + using Integration = pcl::ihs::Integration; + using IntegrationPtr = std::shared_ptr; + using IntegrationConstPtr = std::shared_ptr; - typedef pcl::IntegralImageNormalEstimation NormalEstimation; - typedef boost::shared_ptr NormalEstimationPtr; - typedef boost::shared_ptr NormalEstimationConstPtr; + using NormalEstimation = pcl::IntegralImageNormalEstimation ; + using NormalEstimationPtr = NormalEstimation::Ptr; + using NormalEstimationConstPtr = NormalEstimation::ConstPtr; /** \brief Helper object for the computation thread. Please have a look at the documentation of calcFPS. */ class ComputationFPS : public Base::FPS { public: - ComputationFPS () : Base::FPS () {} + ComputationFPS () {} ~ComputationFPS () {} }; @@ -141,7 +140,7 @@ namespace pcl class VisualizationFPS : public Base::FPS { public: - VisualizationFPS () : Base::FPS () {} + VisualizationFPS () {} ~VisualizationFPS () {} }; @@ -152,8 +151,8 @@ namespace pcl * \return True if success. */ bool - getFilesFromDirectory (const std::string path_dir, - const std::string extension, + getFilesFromDirectory (const std::string& path_dir, + const std::string& extension, std::vector & files) const; /** \brief Load the transformation matrix from the given file. @@ -180,21 +179,21 @@ namespace pcl * \see http://doc.qt.digia.com/qt/opengl-overpainting.html */ void - paintEvent (QPaintEvent* event); + paintEvent (QPaintEvent* event) override; /** \see http://doc.qt.digia.com/qt/qwidget.html#keyPressEvent */ void - keyPressEvent (QKeyEvent* event); + keyPressEvent (QKeyEvent* event) override; ////////////////////////////////////////////////////////////////////////// // Members ////////////////////////////////////////////////////////////////////////// /** \brief Synchronization. */ - boost::mutex mutex_; + std::mutex mutex_; /** \brief Wait until the data finished processing. */ - boost::mutex mutex_quit_; + std::mutex mutex_quit_; /** \brief Please have a look at the documentation of ComputationFPS. */ ComputationFPS computation_fps_; @@ -218,10 +217,7 @@ namespace pcl bool destructor_called_; public: - - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW }; } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_OFFLINE_INTEGRATION_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h index 114050c1..f658af83 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/opengl_viewer.h @@ -38,19 +38,22 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_OPENGL_VIEWER_H -#define PCL_APPS_IN_HAND_SCANNER_OPENGL_VIEWER_H - -#include - -#include +#pragma once #include +#include #include #include #include #include +#include + +#include +#include +#include +#include + namespace pcl { namespace ihs @@ -86,18 +89,17 @@ namespace pcl /** \brief Constructor. Converts the input mesh into a face vertex mesh. */ FaceVertexMesh (const Mesh& mesh, const Eigen::Isometry3d& T); - typedef pcl::ihs::PointIHS PointIHS; - typedef pcl::ihs::CloudIHS CloudIHS; - typedef pcl::ihs::CloudIHSPtr CloudIHSPtr; - typedef pcl::ihs::CloudIHSConstPtr CloudIHSConstPtr; + using PointIHS = pcl::ihs::PointIHS; + using CloudIHS = pcl::ihs::CloudIHS; + using CloudIHSPtr = pcl::ihs::CloudIHSPtr; + using CloudIHSConstPtr = pcl::ihs::CloudIHSConstPtr; CloudIHS vertices; std::vector triangles; Eigen::Isometry3d transformation; public: - - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW }; } // End namespace detail @@ -110,30 +112,30 @@ namespace pcl public: - typedef pcl::PointXYZRGBNormal PointXYZRGBNormal; - typedef pcl::PointCloud CloudXYZRGBNormal; - typedef CloudXYZRGBNormal::Ptr CloudXYZRGBNormalPtr; - typedef CloudXYZRGBNormal::ConstPtr CloudXYZRGBNormalConstPtr; + using PointXYZRGBNormal = pcl::PointXYZRGBNormal; + using CloudXYZRGBNormal = pcl::PointCloud; + using CloudXYZRGBNormalPtr = CloudXYZRGBNormal::Ptr; + using CloudXYZRGBNormalConstPtr = CloudXYZRGBNormal::ConstPtr; - typedef pcl::ihs::Mesh Mesh; - typedef pcl::ihs::MeshPtr MeshPtr; - typedef pcl::ihs::MeshConstPtr MeshConstPtr; + using Mesh = pcl::ihs::Mesh; + using MeshPtr = pcl::ihs::MeshPtr; + using MeshConstPtr = pcl::ihs::MeshConstPtr; /** \brief How to draw the mesh. */ - typedef enum MeshRepresentation + enum MeshRepresentation { MR_POINTS, /**< Draw the points. */ MR_EDGES, /**< Wireframe represen of the mesh. */ MR_FACES /**< Draw the faces of the mesh without edges. */ - } MeshRepresentation; + }; /** \brief How to color the shapes. */ - typedef enum Coloring + enum Coloring { COL_RGB, /**< Coloring according to the rgb values. */ COL_ONE_COLOR, /**< Use one color for all points. */ COL_VISCONF /**< Coloring according to the visibility confidence. */ - } Coloring; + }; /** \brief Coefficients for the wireframe box. */ class BoxCoefficients @@ -165,12 +167,11 @@ namespace pcl Eigen::Isometry3d transformation; public: - - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW }; /** \brief Constructor. */ - explicit OpenGLViewer (QWidget* parent=0); + explicit OpenGLViewer (QWidget* parent=nullptr); /** \brief Destructor. */ ~OpenGLViewer (); @@ -237,12 +238,12 @@ namespace pcl setVisibilityConfidenceNormalization (const float vis_conf_norm); /** \see http://doc.qt.digia.com/qt/qwidget.html#minimumSizeHint-prop */ - virtual QSize - minimumSizeHint () const; + QSize + minimumSizeHint () const override; /** \see http://doc.qt.digia.com/qt/qwidget.html#sizeHint-prop */ - virtual QSize - sizeHint () const; + QSize + sizeHint () const override; /** \brief Set the scaling factor to convert from meters to the unit of the drawn files. */ void @@ -322,26 +323,26 @@ namespace pcl /** \see http://doc.qt.digia.com/qt/qwidget.html#paintEvent * \see http://doc.qt.digia.com/qt/opengl-overpainting.html */ - virtual void - paintEvent (QPaintEvent* event); + void + paintEvent (QPaintEvent* event) override; private: - typedef Eigen::Matrix Color; - typedef Eigen::Matrix Colors; - typedef Eigen::Matrix Colormap; + using Color = Eigen::Matrix ; + using Colors = Eigen::Matrix ; + using Colormap = Eigen::Matrix ; - typedef boost::unordered_map CloudXYZRGBNormalMap; + using CloudXYZRGBNormalMap = std::unordered_map ; - typedef pcl::ihs::PointIHS PointIHS; - typedef pcl::ihs::CloudIHS CloudIHS; - typedef pcl::ihs::CloudIHSPtr CloudIHSPtr; - typedef pcl::ihs::CloudIHSConstPtr CloudIHSConstPtr; + using PointIHS = pcl::ihs::PointIHS; + using CloudIHS = pcl::ihs::CloudIHS; + using CloudIHSPtr = pcl::ihs::CloudIHSPtr; + using CloudIHSConstPtr = pcl::ihs::CloudIHSConstPtr; - typedef pcl::ihs::detail::FaceVertexMesh FaceVertexMesh; - typedef boost::shared_ptr < FaceVertexMesh> FaceVertexMeshPtr; - typedef boost::shared_ptr FaceVertexMeshConstPtr; - typedef boost::unordered_map FaceVertexMeshMap; + using FaceVertexMesh = pcl::ihs::detail::FaceVertexMesh; + using FaceVertexMeshPtr = std::shared_ptr; + using FaceVertexMeshConstPtr = std::shared_ptr; + using FaceVertexMeshMap = std::unordered_map ; /** \brief Check if the mesh with the given id is added. * \note Must lock the mutex before calling this method. @@ -365,7 +366,7 @@ namespace pcl /** \see http://doc.qt.digia.com/qt/qglwidget.html#initializeGL */ void - initializeGL (); + initializeGL () override; /** \see http://www.opengl.org/sdk/docs/man/xhtml/glViewport.xml */ void @@ -373,29 +374,29 @@ namespace pcl /** \see http://doc.qt.digia.com/qt/qglwidget.html#resizeGL */ void - resizeGL (int w, int h); + resizeGL (int w, int h) override; /** \see http://doc.qt.digia.com/qt/qwidget.html#mousePressEvent */ void - mousePressEvent (QMouseEvent* event); + mousePressEvent (QMouseEvent* event) override; /** \see http://doc.qt.digia.com/qt/qwidget.html#mouseMoveEvent */ void - mouseMoveEvent (QMouseEvent* event); + mouseMoveEvent (QMouseEvent* event) override; /** \see http://doc.qt.digia.com/qt/qwidget.html#wheelEvent */ void - wheelEvent (QWheelEvent* event); + wheelEvent (QWheelEvent* event) override; //////////////////////////////////////////////////////////////////////// // Members //////////////////////////////////////////////////////////////////////// /** \brief Synchronization. */ - boost::mutex mutex_vis_; + std::mutex mutex_vis_; /** \brief Visualization timer. */ - boost::shared_ptr timer_vis_; + std::shared_ptr timer_vis_; /** \brief Colormap. */ Colormap colormap_; @@ -443,8 +444,7 @@ namespace pcl int y_prev_; public: - - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW }; } // End namespace ihs } // End namespace pcl @@ -452,5 +452,3 @@ namespace pcl // http://doc.qt.digia.com/qt/qmetatype.html#Q_DECLARE_METATYPE Q_DECLARE_METATYPE (pcl::ihs::OpenGLViewer::MeshRepresentation) Q_DECLARE_METATYPE (pcl::ihs::OpenGLViewer::Coloring) - -#endif // PCL_APPS_IN_HAND_SCANNER_OPENGL_VIEWER_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/utils.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/utils.h index 2fe5b1e4..937734a6 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/utils.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/utils.h @@ -38,8 +38,7 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_UTILS_H -#define PCL_APPS_IN_HAND_SCANNER_UTILS_H +#pragma once namespace pcl { @@ -53,5 +52,3 @@ namespace pcl } } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_UTILS_H diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/visibility_confidence.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/visibility_confidence.h index 11fa7a63..abc7327f 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/visibility_confidence.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/visibility_confidence.h @@ -38,12 +38,12 @@ * */ -#ifndef PCL_APPS_IN_HAND_SCANNER_VISIBILITY_CONFIDENCE_H -#define PCL_APPS_IN_HAND_SCANNER_VISIBILITY_CONFIDENCE_H +#pragma once -#include +#include #include +#include #include namespace pcl @@ -60,7 +60,7 @@ namespace pcl public: static const int num_directions = 31; - typedef Eigen::Matrix Vertices; + using Vertices = Eigen::Matrix ; Dome (); @@ -72,19 +72,16 @@ namespace pcl Vertices vertices_; public: - - EIGEN_MAKE_ALIGNED_OPERATOR_NEW + PCL_MAKE_ALIGNED_OPERATOR_NEW }; PCL_EXPORTS void addDirection (const Eigen::Vector4f& normal, const Eigen::Vector4f& direction, - uint32_t& directions); + std::uint32_t& directions); PCL_EXPORTS unsigned int - countDirections (const uint32_t directions); + countDirections (const std::uint32_t directions); } // End namespace ihs } // End namespace pcl - -#endif // PCL_APPS_IN_HAND_SCANNER_VISIBILITY_CONFIDENCE_H diff --git a/apps/in_hand_scanner/src/icp.cpp b/apps/in_hand_scanner/src/icp.cpp index ffac8ca5..76471466 100644 --- a/apps/in_hand_scanner/src/icp.cpp +++ b/apps/in_hand_scanner/src/icp.cpp @@ -160,7 +160,7 @@ pcl::ihs::ICP::findTransformation (const MeshConstPtr& mesh_model, { // Check the input // TODO: Double check the minimum number of points necessary for icp - const size_t n_min = 4; + const std::size_t n_min = 4; if(mesh_model->sizeVertices () < n_min || cloud_data->size () < n_min) { @@ -194,8 +194,8 @@ pcl::ihs::ICP::findTransformation (const MeshConstPtr& mesh_model, const CloudNormalConstPtr cloud_data_selected = this->selectDataPoints (cloud_data); t_select = sw.getTime (); - const size_t n_model = cloud_model_selected->size (); - const size_t n_data = cloud_data_selected->size (); + const std::size_t n_model = cloud_model_selected->size (); + const std::size_t n_data = cloud_data_selected->size (); if(n_model < n_min) {std::cerr << "ERROR in icp.cpp: Not enough model points after selection!\n"; return (false);} if(n_data < n_min) {std::cerr << "ERROR in icp.cpp: Not enough data points after selection!\n"; return (false);} @@ -244,7 +244,7 @@ pcl::ihs::ICP::findTransformation (const MeshConstPtr& mesh_model, // Check the distance threshold if (squared_distance [0] < squared_distance_threshold) { - if ((size_t) index [0] >= cloud_model_selected->size ()) + if ((std::size_t) index [0] >= cloud_model_selected->size ()) { std::cerr << "ERROR in icp.cpp: Segfault!\n"; std::cerr << " Trying to access index " << index [0] << " >= " << cloud_model_selected->size () << std::endl; @@ -266,7 +266,7 @@ pcl::ihs::ICP::findTransformation (const MeshConstPtr& mesh_model, t_nn_search += sw.getTime (); - const size_t n_corr = cloud_data_corr.size (); + const std::size_t n_corr = cloud_data_corr.size (); if (n_corr < n_min) { std::cerr << "ERROR in icp.cpp: Not enough correspondences: " << n_corr << " < " << n_min << std::endl; @@ -356,16 +356,13 @@ pcl::ihs::ICP::findTransformation (const MeshConstPtr& mesh_model, { return (false); } - else if (delta_fitness <= epsilon_) + if (delta_fitness <= epsilon_) { T_final = T_cur; return (true); } - else - { - std::cerr << "ERROR in icp.cpp: Congratulations! you found a bug.\n"; - exit (EXIT_FAILURE); - } + std::cerr << "ERROR in icp.cpp: Congratulations! you found a bug.\n"; + exit (EXIT_FAILURE); } //////////////////////////////////////////////////////////////////////////////// @@ -379,14 +376,14 @@ pcl::ihs::ICP::selectModelPoints (const MeshConstPtr& mesh_model, const Mesh::VertexDataCloud& cloud = mesh_model->getVertexDataCloud (); - for (Mesh::VertexDataCloud::const_iterator it=cloud.begin (); it!=cloud.end (); ++it) + for (const auto &vertex_data : cloud) { // Don't consider points that are facing away from the camera. - if ((T_inv.lazyProduct (it->getNormalVector4fMap ())).z () < 0.f) + if ((T_inv.lazyProduct (vertex_data.getNormalVector4fMap ())).z () < 0.f) { PointNormal pt; - pt.getVector4fMap () = it->getVector4fMap (); - pt.getNormalVector4fMap () = it->getNormalVector4fMap (); + pt.getVector4fMap () = vertex_data.getVector4fMap (); + pt.getNormalVector4fMap () = vertex_data.getNormalVector4fMap (); // NOTE: Not the transformed points!! cloud_model_out->push_back (pt); @@ -404,14 +401,13 @@ pcl::ihs::ICP::selectDataPoints (const CloudXYZRGBNormalConstPtr& cloud_data) co const CloudNormalPtr cloud_data_out (new CloudNormal ()); cloud_data_out->reserve (cloud_data->size ()); - CloudXYZRGBNormal::const_iterator it_in = cloud_data->begin (); - for (; it_in!=cloud_data->end (); ++it_in) + for (const auto &vertex_data : *cloud_data) { - if (!boost::math::isnan (it_in->x)) + if (!std::isnan (vertex_data.x)) { PointNormal pt; - pt.getVector4fMap () = it_in->getVector4fMap (); - pt.getNormalVector4fMap () = it_in->getNormalVector4fMap (); + pt.getVector4fMap () = vertex_data.getVector4fMap (); + pt.getNormalVector4fMap () = vertex_data.getNormalVector4fMap (); cloud_data_out->push_back (pt); } @@ -429,7 +425,7 @@ pcl::ihs::ICP::minimizePointPlane (const CloudNormal& cloud_source, { // Check the input // n < n_min already checked in the icp main loop - const size_t n = cloud_source.size (); + const std::size_t n = cloud_source.size (); if (cloud_target.size () != n) { std::cerr << "ERROR in icp.cpp: Input must have the same size!\n"; @@ -449,7 +445,7 @@ pcl::ihs::ICP::minimizePointPlane (const CloudNormal& cloud_source, pcl::compute3DCentroid (cloud_target, c_t); c_t.w () = 1.f; // The normals are only needed for the target - typedef std::vector > Vec4Xf; + using Vec4Xf = std::vector >; Vec4Xf xyz_s, xyz_t, nor_t; xyz_s.reserve (n); xyz_t.reserve (n); @@ -500,7 +496,6 @@ pcl::ihs::ICP::minimizePointPlane (const CloudNormal& cloud_source, Vec4Xf::const_iterator it_nor_t = nor_t.begin (); Eigen::Vector4f cross; - float dot; for (; it_xyz_s!=xyz_s.end (); ++it_xyz_s, ++it_xyz_t, ++it_nor_t) { cross = it_xyz_s->cross3 (*it_nor_t); @@ -509,7 +504,7 @@ pcl::ihs::ICP::minimizePointPlane (const CloudNormal& cloud_source, C_tr_bl += cross * it_nor_t->transpose (); C_br += *it_nor_t * it_nor_t->transpose (); - dot = (*it_xyz_t-*it_xyz_s).dot (*it_nor_t); + float dot = (*it_xyz_t-*it_xyz_s).dot (*it_nor_t); b_t += cross * dot; b_b += *it_nor_t * dot; diff --git a/apps/in_hand_scanner/src/in_hand_scanner.cpp b/apps/in_hand_scanner/src/in_hand_scanner.cpp index 56211a4f..c385c063 100644 --- a/apps/in_hand_scanner/src/in_hand_scanner.cpp +++ b/apps/in_hand_scanner/src/in_hand_scanner.cpp @@ -44,9 +44,7 @@ #include #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) -#include -#endif +#include #include #include @@ -65,14 +63,9 @@ pcl::ihs::InHandScanner::InHandScanner (Base* parent) : Base (parent), - mutex_ (), - computation_fps_ (), - visualization_fps_ (), running_mode_ (RM_UNPROCESSED), iteration_ (0), - grabber_ (), starting_grabber_ (false), - new_data_connection_ (), input_data_processing_ (new InputDataProcessing ()), icp_ (new ICP ()), transformation_ (Eigen::Matrix4f::Identity ()), @@ -101,7 +94,7 @@ pcl::ihs::InHandScanner::InHandScanner (Base* parent) pcl::ihs::InHandScanner::~InHandScanner () { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); destructor_called_ = true; if (grabber_ && grabber_->isRunning ()) grabber_->stop (); @@ -113,7 +106,7 @@ pcl::ihs::InHandScanner::~InHandScanner () void pcl::ihs::InHandScanner::startGrabber () { - QtConcurrent::run (boost::bind (&pcl::ihs::InHandScanner::startGrabberImpl, this)); + QtConcurrent::run ([this] { startGrabberImpl (); }); } //////////////////////////////////////////////////////////////////////////////// @@ -121,7 +114,7 @@ pcl::ihs::InHandScanner::startGrabber () void pcl::ihs::InHandScanner::showUnprocessedData () { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); if (destructor_called_) return; std::cerr << "Showing the unprocessed input data.\n"; @@ -137,7 +130,7 @@ pcl::ihs::InHandScanner::showUnprocessedData () void pcl::ihs::InHandScanner::showProcessedData () { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); if (destructor_called_) return; std::cerr << "Showing the processed input data.\n"; @@ -153,7 +146,7 @@ pcl::ihs::InHandScanner::showProcessedData () void pcl::ihs::InHandScanner::registerContinuously () { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); if (destructor_called_) return; std::cerr << "Continuous registration.\n"; @@ -169,7 +162,7 @@ pcl::ihs::InHandScanner::registerContinuously () void pcl::ihs::InHandScanner::registerOnce () { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); if (destructor_called_) return; std::cerr << "Single registration.\n"; @@ -184,7 +177,7 @@ pcl::ihs::InHandScanner::registerOnce () void pcl::ihs::InHandScanner::showModel () { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); if (destructor_called_) return; std::cerr << "Show the model\n"; @@ -199,7 +192,7 @@ pcl::ihs::InHandScanner::showModel () void pcl::ihs::InHandScanner::removeUnfitVertices () { - boost::mutex::scoped_lock lock (mutex_); + std::unique_lock lock (mutex_); if (destructor_called_) return; std::cerr << "Removing unfit vertices ...\n"; @@ -223,7 +216,7 @@ pcl::ihs::InHandScanner::removeUnfitVertices () void pcl::ihs::InHandScanner::reset () { - boost::mutex::scoped_lock lock (mutex_); + std::unique_lock lock (mutex_); if (destructor_called_) return; std::cerr << "Reset the scanning pipeline.\n"; @@ -243,7 +236,7 @@ pcl::ihs::InHandScanner::reset () void pcl::ihs::InHandScanner::saveAs (const std::string& filename, const FileType& filetype) { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); if (destructor_called_) return; pcl::PolygonMesh pm; @@ -289,7 +282,7 @@ pcl::ihs::InHandScanner::newDataCallback (const CloudXYZRGBAConstPtr& cloud_in) { Base::calcFPS (computation_fps_); // Must come before the lock! - boost::mutex::scoped_lock lock (mutex_); + std::unique_lock lock (mutex_); if (destructor_called_) return; pcl::StopWatch sw; @@ -415,7 +408,7 @@ pcl::ihs::InHandScanner::newDataCallback (const CloudXYZRGBAConstPtr& cloud_in) void pcl::ihs::InHandScanner::paintEvent (QPaintEvent* event) { - // boost::mutex::scoped_lock lock (mutex_); + // std::lock_guard lock (mutex_); if (destructor_called_) return; Base::calcFPS (visualization_fps_); @@ -471,7 +464,7 @@ pcl::ihs::InHandScanner::drawText () void pcl::ihs::InHandScanner::startGrabberImpl () { - boost::mutex::scoped_lock lock (mutex_); + std::unique_lock lock (mutex_); starting_grabber_ = true; lock.unlock (); @@ -488,7 +481,7 @@ pcl::ihs::InHandScanner::startGrabberImpl () lock.lock (); if (destructor_called_) return; - boost::function new_data_cb = boost::bind (&pcl::ihs::InHandScanner::newDataCallback, this, _1); + std::function new_data_cb = [this] (const CloudXYZRGBAConstPtr& cloud) { newDataCallback (cloud); }; new_data_connection_ = grabber_->registerCallback (new_data_cb); grabber_->start (); diff --git a/apps/in_hand_scanner/src/input_data_processing.cpp b/apps/in_hand_scanner/src/input_data_processing.cpp index 22200a9a..1afbb53d 100644 --- a/apps/in_hand_scanner/src/input_data_processing.cpp +++ b/apps/in_hand_scanner/src/input_data_processing.cpp @@ -126,7 +126,7 @@ pcl::ihs::InputDataProcessing::segment (const CloudXYZRGBAConstPtr& cloud_in, xyz_mask (r, c) = hsv_mask (r, c) = false; - if (!boost::math::isnan (xyzrgb.x) && !boost::math::isnan (normal.normal_x) && + if (!std::isnan (xyzrgb.x) && !std::isnan (normal.normal_x) && xyzrgb.x >= x_min && xyzrgb.x <= x_max && xyzrgb.y >= y_min && xyzrgb.y <= y_max && xyzrgb.z >= z_min && xyzrgb.z <= z_max) @@ -234,7 +234,6 @@ pcl::ihs::InputDataProcessing::calculateNormals (const CloudXYZRGBAConstPtr& clo cloud_out->height = cloud_in->height; cloud_out->is_dense = false; - CloudXYZRGBA::const_iterator it_in = cloud_in->begin (); CloudNormals::const_iterator it_n = cloud_normals->begin (); CloudXYZRGBNormal::iterator it_out = cloud_out->begin (); @@ -244,9 +243,9 @@ pcl::ihs::InputDataProcessing::calculateNormals (const CloudXYZRGBAConstPtr& clo invalid_pt.data [3] = 1.f; invalid_pt.data_n [3] = 0.f; - for (; it_in!=cloud_in->end (); ++it_in, ++it_n, ++it_out) + for (auto it_in = cloud_in->begin (); it_in!=cloud_in->end (); ++it_in, ++it_n, ++it_out) { - if (!boost::math::isnan (it_n->getNormalVector4fMap ())) + if (!it_n->getNormalVector4fMap (). hasNaN ()) { // m -> cm it_out->getVector4fMap () = 100.f * it_in->getVector4fMap (); diff --git a/apps/in_hand_scanner/src/integration.cpp b/apps/in_hand_scanner/src/integration.cpp index 1510dc52..94727063 100644 --- a/apps/in_hand_scanner/src/integration.cpp +++ b/apps/in_hand_scanner/src/integration.cpp @@ -101,7 +101,7 @@ pcl::ihs::Integration::reconstructMesh (const CloudXYZRGBNormalConstPtr& cloud_d const PointXYZRGBNormal& pt_d = cloud_data->operator [] (c); const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1]) - if (!boost::math::isnan (pt_d.x) && weight > min_weight_) + if (!std::isnan (pt_d.x) && weight > min_weight_) { cloud_model->operator [] (c) = PointIHS (pt_d, weight); } @@ -113,7 +113,7 @@ pcl::ihs::Integration::reconstructMesh (const CloudXYZRGBNormalConstPtr& cloud_d const PointXYZRGBNormal& pt_d = cloud_data->operator [] (r*width + c); const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1]) - if (!boost::math::isnan (pt_d.x) && weight > min_weight_) + if (!std::isnan (pt_d.x) && weight > min_weight_) { cloud_model->operator [] (r*width + c) = PointIHS (pt_d, weight); } @@ -163,7 +163,7 @@ pcl::ihs::Integration::reconstructMesh (const CloudXYZRGBNormalConstPtr& cloud_d const float weight = -pt_d_0.normal_z; // weight = -dot (normal, [0; 0; 1]) - if (!boost::math::isnan (pt_d_0.x) && weight > min_weight_) + if (!std::isnan (pt_d_0.x) && weight > min_weight_) { pt_m_0 = PointIHS (pt_d_0, weight); } @@ -213,7 +213,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data, // Nearest neighbor search CloudXYZPtr xyz_model (new CloudXYZ ()); xyz_model->reserve (mesh_model->sizeVertices ()); - for (unsigned int i=0; isizeVertices (); ++i) + for (std::size_t i=0; isizeVertices (); ++i) { const PointIHS& pt = mesh_model->getVertexDataCloud () [i]; xyz_model->push_back (PointXYZ (pt.x, pt.y, pt.z)); @@ -242,7 +242,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data, const PointXYZRGBNormal& pt_d = cloud_data->operator [] (c); const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1]) - if (!boost::math::isnan (pt_d.x) && weight > min_weight_) + if (!std::isnan (pt_d.x) && weight > min_weight_) { PointIHS& pt_d_t = cloud_data_transformed->operator [] (c); pt_d_t = PointIHS (pt_d, weight); @@ -257,7 +257,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data, const PointXYZRGBNormal& pt_d = cloud_data->operator [] (r*width + c); const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1]) - if (!boost::math::isnan (pt_d.x) && weight > min_weight_) + if (!std::isnan (pt_d.x) && weight > min_weight_) { PointIHS& pt_d_t = cloud_data_transformed->operator [] (r*width + c); pt_d_t = PointIHS (pt_d, weight); @@ -312,7 +312,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data, const float weight = -pt_d_0.normal_z; // weight = -dot (normal, [0; 0; 1]) - if (!boost::math::isnan (pt_d_0.x) && weight > min_weight_) + if (!std::isnan (pt_d_0.x) && weight > min_weight_) { pt_d_t_0 = PointIHS (pt_d_0, weight); pt_d_t_0.getVector4fMap () = T * pt_d_t_0.getVector4fMap (); @@ -388,7 +388,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data, void pcl::ihs::Integration::age (const MeshPtr& mesh, const bool cleanup) const { - for (unsigned int i=0; isizeVertices (); ++i) + for (std::size_t i=0; isizeVertices (); ++i) { PointIHS& pt = mesh->getVertexDataCloud () [i]; if (pt.age < max_age_) @@ -422,7 +422,7 @@ pcl::ihs::Integration::age (const MeshPtr& mesh, const bool cleanup) const void pcl::ihs::Integration::removeUnfitVertices (const MeshPtr& mesh, const bool cleanup) const { - for (unsigned int i=0; isizeVertices (); ++i) + for (std::size_t i=0; isizeVertices (); ++i) { if (pcl::ihs::countDirections (mesh->getVertexDataCloud () [i].directions) < min_directions_) { @@ -495,10 +495,10 @@ pcl::ihs::Integration::getMinDirections () const //////////////////////////////////////////////////////////////////////////////// -uint8_t +std::uint8_t pcl::ihs::Integration::trimRGB (const float val) const { - return (static_cast (val > 255.f ? 255 : val)); + return (static_cast (val > 255.f ? 255 : val)); } //////////////////////////////////////////////////////////////////////////////// @@ -519,10 +519,10 @@ pcl::ihs::Integration::addToMesh (const PointIHS& pt_0, // | | // 3 - 0 const unsigned char is_finite = static_cast ( - (1 * !boost::math::isnan (pt_0.x)) | - (2 * !boost::math::isnan (pt_1.x)) | - (4 * !boost::math::isnan (pt_2.x)) | - (8 * !boost::math::isnan (pt_3.x))); + (1 * !std::isnan (pt_0.x)) | + (2 * !std::isnan (pt_1.x)) | + (4 * !std::isnan (pt_2.x)) | + (8 * !std::isnan (pt_3.x))); switch (is_finite) { diff --git a/apps/in_hand_scanner/src/main.cpp b/apps/in_hand_scanner/src/main.cpp index 86c76ecc..d404dc0c 100644 --- a/apps/in_hand_scanner/src/main.cpp +++ b/apps/in_hand_scanner/src/main.cpp @@ -48,5 +48,5 @@ main (int argc, char** argv) QApplication app (argc, argv); pcl::ihs::MainWindow mw; mw.show (); - return (app.exec ()); + return (QApplication::exec ()); } diff --git a/apps/in_hand_scanner/src/main_offline_integration.cpp b/apps/in_hand_scanner/src/main_offline_integration.cpp index e4883dc1..a8edc1bf 100644 --- a/apps/in_hand_scanner/src/main_offline_integration.cpp +++ b/apps/in_hand_scanner/src/main_offline_integration.cpp @@ -50,5 +50,5 @@ main (int argc, char** argv) pcl::ihs::OfflineIntegration oi; QTimer::singleShot(0, &oi, SLOT (start ())); oi.show (); - return (app.exec ()); + return (QApplication::exec ()); } diff --git a/apps/in_hand_scanner/src/mesh_processing.cpp b/apps/in_hand_scanner/src/mesh_processing.cpp index 7ec8ad86..feaf6f48 100644 --- a/apps/in_hand_scanner/src/mesh_processing.cpp +++ b/apps/in_hand_scanner/src/mesh_processing.cpp @@ -55,15 +55,12 @@ pcl::ihs::MeshProcessing::MeshProcessing () void pcl::ihs::MeshProcessing::processBoundary (Mesh& mesh, const std::vector & boundary_collection, const bool cleanup) const { - typedef std::vector BoundaryCollection; - Mesh::VertexIndex vi_a, vi_b, vi_c, vi_d; Eigen::Vector3f ab, bc, ac, n_adb, n_plane; // Edges and normals Mesh::FaceIndex opposite_face; - for (BoundaryCollection::const_iterator it_bc=boundary_collection.begin (); it_bc!=boundary_collection.end (); ++it_bc) + for (const auto &boundary : boundary_collection) { - const Mesh::HalfEdgeIndices& boundary = *it_bc; if (boundary.size () == 3) { opposite_face = mesh.getOppositeFaceIndex (boundary [0]); @@ -93,7 +90,7 @@ pcl::ihs::MeshProcessing::processBoundary (Mesh& mesh, const std::vector #include #include -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) -#include -#endif +#include #include #include @@ -63,11 +61,6 @@ pcl::ihs::OfflineIntegration::OfflineIntegration (Base* parent) : Base (parent), - mutex_ (), - mutex_quit_ (), - computation_fps_ (), - visualization_fps_ (), - path_dir_ (), mesh_model_ (new Mesh ()), normal_estimation_ (new NormalEstimation ()), integration_ (new Integration ()), @@ -88,8 +81,8 @@ pcl::ihs::OfflineIntegration::OfflineIntegration (Base* parent) pcl::ihs::OfflineIntegration::~OfflineIntegration () { - boost::mutex::scoped_lock lock (mutex_); - boost::mutex::scoped_lock lock_quit (mutex_quit_); + std::lock_guard lock (mutex_); + std::lock_guard lock_quit (mutex_quit_); destructor_called_ = true; } @@ -98,7 +91,7 @@ pcl::ihs::OfflineIntegration::~OfflineIntegration () void pcl::ihs::OfflineIntegration::start () { - QString dir = QFileDialog::getExistingDirectory (0, "Please select a directory containing .pcd and .transform files."); + QString dir = QFileDialog::getExistingDirectory (nullptr, "Please select a directory containing .pcd and .transform files."); if (dir.isEmpty ()) { @@ -106,7 +99,7 @@ pcl::ihs::OfflineIntegration::start () } path_dir_ = dir.toStdString (); - QtConcurrent::run (boost::bind (&pcl::ihs::OfflineIntegration::computationThread, this)); + QtConcurrent::run ([this]{ computationThread (); }); } //////////////////////////////////////////////////////////////////////////////// @@ -143,20 +136,20 @@ pcl::ihs::OfflineIntegration::computationThread () Base::setPivot ("model"); Base::addMesh (mesh_model_, "model"); - if (filenames.size () < 1) + if (filenames.empty ()) { return; } - for (unsigned int i=1; i lock (mutex_); if (destructor_called_) return; } - boost::mutex::scoped_lock lock_quit (mutex_quit_); + std::unique_lock lock_quit (mutex_quit_); CloudXYZRGBNormalPtr cloud_data (new CloudXYZRGBNormal ()); if (!this->load (filenames [i], cloud_data, T)) @@ -175,7 +168,7 @@ pcl::ihs::OfflineIntegration::computationThread () { lock_quit.unlock (); - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); if (destructor_called_) return; Base::addMesh (mesh_model_, "model", Eigen::Isometry3d (T.inverse ().cast ())); @@ -188,11 +181,11 @@ pcl::ihs::OfflineIntegration::computationThread () //////////////////////////////////////////////////////////////////////////////// bool -pcl::ihs::OfflineIntegration::getFilesFromDirectory (const std::string path_dir, - const std::string extension, +pcl::ihs::OfflineIntegration::getFilesFromDirectory (const std::string& path_dir, + const std::string& extension, std::vector & files) const { - if (path_dir == "" || !boost::filesystem::exists (path_dir)) + if (path_dir.empty() || !boost::filesystem::exists (path_dir)) { std::cerr << "ERROR in offline_integration.cpp: Invalid path\n '" << path_dir << "'\n"; return (false); @@ -286,7 +279,7 @@ pcl::ihs::OfflineIntegration::load (const std::string& filename, // Load the transformation. std::string fn_transform = filename; - size_t pos = fn_transform.find_last_of ("."); + std::size_t pos = fn_transform.find_last_of ('.'); if (pos == std::string::npos || pos == (fn_transform.size () - 1)) { std::cerr << "ERROR in offline_integration.cpp: No file extension\n"; @@ -319,7 +312,7 @@ pcl::ihs::OfflineIntegration::paintEvent (QPaintEvent* event) std::string vis_fps ("Visualization: "), comp_fps ("Computation: "); { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); this->calcFPS (visualization_fps_); vis_fps.append (visualization_fps_.str ()).append (" fps"); @@ -338,7 +331,7 @@ pcl::ihs::OfflineIntegration::keyPressEvent (QKeyEvent* event) { if (event->key () == Qt::Key_Escape) { - boost::mutex::scoped_lock lock (mutex_); + std::lock_guard lock (mutex_); QApplication::quit (); } diff --git a/apps/in_hand_scanner/src/opengl_viewer.cpp b/apps/in_hand_scanner/src/opengl_viewer.cpp index 784e03f0..9cdab712 100644 --- a/apps/in_hand_scanner/src/opengl_viewer.cpp +++ b/apps/in_hand_scanner/src/opengl_viewer.cpp @@ -64,9 +64,7 @@ //////////////////////////////////////////////////////////////////////////////// pcl::ihs::detail::FaceVertexMesh::FaceVertexMesh () - : vertices (), - triangles (), - transformation (Eigen::Isometry3d::Identity ()) + : transformation (Eigen::Isometry3d::Identity ()) { } @@ -74,7 +72,6 @@ pcl::ihs::detail::FaceVertexMesh::FaceVertexMesh () pcl::ihs::detail::FaceVertexMesh::FaceVertexMesh (const Mesh& mesh, const Eigen::Isometry3d& T) : vertices (mesh.getVertexDataCloud ()), - triangles (), transformation (T) { if (typeid (Mesh::MeshTag) != typeid (pcl::geometry::TriangleMeshTag)) @@ -83,15 +80,15 @@ pcl::ihs::detail::FaceVertexMesh::FaceVertexMesh (const Mesh& mesh, const Eigen: exit (EXIT_FAILURE); } - for (CloudIHS::iterator it=vertices.begin (); it!=vertices.end (); ++it) + for (auto &vertex : vertices) { - std::swap (it->r, it->b); + std::swap (vertex.r, vertex.b); } triangles.reserve (mesh.sizeFaces ()); pcl::ihs::detail::FaceVertexMesh::Triangle triangle; - for (unsigned int i=0; i lock (mutex_vis_); if (this->getMeshIsAdded (id)) drawn_meshes_ [id] = FaceVertexMeshPtr (new FaceVertexMesh (*mesh, T)); @@ -537,9 +531,9 @@ pcl::ihs::OpenGLViewer::addMesh (const CloudXYZRGBNormalConstPtr& cloud, const s const PointXYZRGBNormal& pt_2 = cloud->operator [] (ind_o_2); const PointXYZRGBNormal& pt_3 = cloud->operator [] (ind_o_3); - if (!boost::math::isnan (pt_1.x) && !boost::math::isnan (pt_3.x)) + if (!std::isnan (pt_1.x) && !std::isnan (pt_3.x)) { - if (!boost::math::isnan (pt_2.x)) // 1-2-3 is valid + if (!std::isnan (pt_2.x)) // 1-2-3 is valid { if (std::abs (pt_1.z - pt_2.z) < 1 && std::abs (pt_1.z - pt_3.z) < 1 && @@ -549,10 +543,10 @@ pcl::ihs::OpenGLViewer::addMesh (const CloudXYZRGBNormalConstPtr& cloud, const s ind_v_2 = addVertex (pt_2, vertices, indices [ind_o_2]); ind_v_3 = addVertex (pt_3, vertices, indices [ind_o_3]); - triangles.push_back (FaceVertexMesh::Triangle (ind_v_1, ind_v_2, ind_v_3)); + triangles.emplace_back(ind_v_1, ind_v_2, ind_v_3); } } - if (!boost::math::isnan (pt_0.x)) // 0-1-3 is valid + if (!std::isnan (pt_0.x)) // 0-1-3 is valid { if (std::abs (pt_0.z - pt_1.z) < 1 && std::abs (pt_0.z - pt_3.z) < 1 && @@ -562,7 +556,7 @@ pcl::ihs::OpenGLViewer::addMesh (const CloudXYZRGBNormalConstPtr& cloud, const s ind_v_3 = addVertex (pt_3, vertices, indices [ind_o_3]); ind_v_0 = addVertex (pt_0, vertices, indices [ind_o_0]); - triangles.push_back (FaceVertexMesh::Triangle (ind_v_1, ind_v_3, ind_v_0)); + triangles.emplace_back(ind_v_1, ind_v_3, ind_v_0); } } } @@ -570,7 +564,7 @@ pcl::ihs::OpenGLViewer::addMesh (const CloudXYZRGBNormalConstPtr& cloud, const s } // Finally add the mesh. - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); if (this->getMeshIsAdded (id)) drawn_meshes_ [id] = mesh; @@ -585,7 +579,7 @@ pcl::ihs::OpenGLViewer::addMesh (const CloudXYZRGBNormalConstPtr& cloud, const s bool pcl::ihs::OpenGLViewer::removeMesh (const std::string& id) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); if (!this->getMeshIsAdded (id)) return (false); drawn_meshes_.erase (id); @@ -598,7 +592,7 @@ pcl::ihs::OpenGLViewer::removeMesh (const std::string& id) void pcl::ihs::OpenGLViewer::removeAllMeshes () { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); drawn_meshes_.clear (); } @@ -607,7 +601,7 @@ pcl::ihs::OpenGLViewer::removeAllMeshes () void pcl::ihs::OpenGLViewer::setBoxCoefficients (const BoxCoefficients& coeffs) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); box_coefficients_ = coeffs; } @@ -616,7 +610,7 @@ pcl::ihs::OpenGLViewer::setBoxCoefficients (const BoxCoefficients& coeffs) void pcl::ihs::OpenGLViewer::setDrawBox (const bool enabled) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); draw_box_ = enabled; } @@ -633,7 +627,7 @@ pcl::ihs::OpenGLViewer::getDrawBox () const void pcl::ihs::OpenGLViewer::setPivot (const Eigen::Vector3d& pivot) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); cam_pivot_ = pivot; } @@ -642,7 +636,7 @@ pcl::ihs::OpenGLViewer::setPivot (const Eigen::Vector3d& pivot) void pcl::ihs::OpenGLViewer::setPivot (const std::string& id) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); cam_pivot_id_ = id; } @@ -651,7 +645,7 @@ pcl::ihs::OpenGLViewer::setPivot (const std::string& id) void pcl::ihs::OpenGLViewer::stopTimer () { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); if (timer_vis_) { timer_vis_->stop (); @@ -663,7 +657,7 @@ pcl::ihs::OpenGLViewer::stopTimer () void pcl::ihs::OpenGLViewer::setVisibilityConfidenceNormalization (const float vis_conf_norm) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); vis_conf_norm_ = vis_conf_norm < 1 ? 1 : vis_conf_norm; } @@ -689,7 +683,7 @@ pcl::ihs::OpenGLViewer::sizeHint () const void pcl::ihs::OpenGLViewer::setScalingFactor (const double scale) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); scaling_factor_ = scale; } @@ -706,7 +700,7 @@ pcl::ihs::OpenGLViewer::timerCallback () void pcl::ihs::OpenGLViewer::resetCamera () { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); R_cam_ = Eigen::Quaterniond (1., 0., 0., 0.); t_cam_ = Eigen::Vector3d (0., 0., 0.); @@ -731,7 +725,7 @@ pcl::ihs::OpenGLViewer::toggleMeshRepresentation () void pcl::ihs::OpenGLViewer::setMeshRepresentation (const MeshRepresentation& representation) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); switch (mesh_representation_) { @@ -763,7 +757,7 @@ pcl::ihs::OpenGLViewer::toggleColoring () void pcl::ihs::OpenGLViewer::setColoring (const Coloring& coloring) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); switch (coloring) { @@ -828,7 +822,7 @@ pcl::ihs::OpenGLViewer::paintEvent (QPaintEvent* /*event*/) Eigen::Quaterniond R_cam; Eigen::Vector3d t_cam; { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); R_cam = R_cam_; t_cam = t_cam_; } @@ -858,7 +852,7 @@ pcl::ihs::OpenGLViewer::paintEvent (QPaintEvent* /*event*/) bool pcl::ihs::OpenGLViewer::getMeshIsAdded (const std::string& id) { - // boost::mutex::scoped_lock lock (mutex_vis_); + // std::lock_guard lock (mutex_vis_); return (drawn_meshes_.find (id) != drawn_meshes_.end ()); } @@ -867,7 +861,7 @@ pcl::ihs::OpenGLViewer::getMeshIsAdded (const std::string& id) void pcl::ihs::OpenGLViewer::calcPivot () { - boost::mutex::scoped_lock lock (mutex_vis_); + std::unique_lock lock (mutex_vis_); if (this->getMeshIsAdded (cam_pivot_id_)) { Eigen::Vector4f pivot; @@ -888,7 +882,7 @@ pcl::ihs::OpenGLViewer::calcPivot () void pcl::ihs::OpenGLViewer::drawMeshes () { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); glEnableClientState (GL_VERTEX_ARRAY); glEnableClientState (GL_NORMAL_ARRAY); @@ -932,7 +926,7 @@ pcl::ihs::OpenGLViewer::drawMeshes () } case COL_VISCONF: { - for (unsigned int i=0; i ( @@ -981,7 +975,7 @@ pcl::ihs::OpenGLViewer::drawBox () { BoxCoefficients coeffs; { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); if (draw_box_) coeffs = box_coefficients_; else return; } @@ -1082,7 +1076,7 @@ pcl::ihs::OpenGLViewer::resizeGL (int w, int h) void pcl::ihs::OpenGLViewer::mousePressEvent (QMouseEvent* /*event*/) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); mouse_pressed_begin_ = true; } @@ -1091,7 +1085,7 @@ pcl::ihs::OpenGLViewer::mousePressEvent (QMouseEvent* /*event*/) void pcl::ihs::OpenGLViewer::mouseMoveEvent (QMouseEvent* event) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); if (mouse_pressed_begin_) { @@ -1146,7 +1140,7 @@ pcl::ihs::OpenGLViewer::wheelEvent (QWheelEvent* event) { if (QApplication::mouseButtons () == Qt::NoButton) { - boost::mutex::scoped_lock lock (mutex_vis_); + std::lock_guard lock (mutex_vis_); // Scale with the distance between the pivot and camera eye. const Eigen::Vector3d o = Eigen::Vector3d::Zero (); diff --git a/apps/in_hand_scanner/src/visibility_confidence.cpp b/apps/in_hand_scanner/src/visibility_confidence.cpp index 90ebfd6a..d0bda321 100644 --- a/apps/in_hand_scanner/src/visibility_confidence.cpp +++ b/apps/in_hand_scanner/src/visibility_confidence.cpp @@ -74,7 +74,7 @@ pcl::ihs::Dome::Dome () vertices_.col (29) = Eigen::Vector4f (-0.187592626f, -0.577350378f, 0.794654489f, 0.f); vertices_.col (30) = Eigen::Vector4f ( 0.491123348f, -0.356822133f, 0.794654548f, 0.f); - for (unsigned int i=0; i ().normalize (); } @@ -103,7 +103,7 @@ namespace pcl void pcl::ihs::addDirection (const Eigen::Vector4f& normal, const Eigen::Vector4f& direction, - uint32_t& directions) + std::uint32_t& directions) { // Find the rotation that aligns the normal with [0; 0; 1] const float dot = normal.z (); @@ -114,7 +114,7 @@ pcl::ihs::addDirection (const Eigen::Vector4f& normal, // TODO: The threshold is hard coded for a frequency=3. // It can be calculated with // - max_z = maximum z value of the dome vertices (excluding [0; 0; 1]) - // - thresh = cos (acos (max_z) / 2) + // - thresh = std::cos (std::acos (max_z) / 2) // - always round up! // - with max_z = 0.939 -> thresh = 0.9847 ~ 0.985 if (dot <= .985f) @@ -133,8 +133,8 @@ pcl::ihs::addDirection (const Eigen::Vector4f& normal, } // Find the closest viewing direction - // NOTE: cos (0deg) = 1 = max - // acos (angle) = dot (a, b) / (norm (a) * norm (b) + // NOTE: std::cos (0deg) = 1 = max + // std::acos (angle) = dot (a, b) / (norm (a) * norm (b) // m_sphere_vertices are already normalized unsigned int index = 0; aligned_direction.transpose ().lazyProduct (pcl::ihs::dome.getVertices ()).maxCoeff (&index); @@ -147,7 +147,7 @@ pcl::ihs::addDirection (const Eigen::Vector4f& normal, //////////////////////////////////////////////////////////////////////////////// unsigned int -pcl::ihs::countDirections (const uint32_t directions) +pcl::ihs::countDirections (const std::uint32_t directions) { // http://stackoverflow.com/questions/109023/best-algorithm-to-count-the-number-of-set-bits-in-a-32-bit-integer/109025#109025 unsigned int i = directions - ((directions >> 1) & 0x55555555); diff --git a/apps/include/pcl/apps/dominant_plane_segmentation.h b/apps/include/pcl/apps/dominant_plane_segmentation.h index a996bed6..3bc7fb62 100644 --- a/apps/include/pcl/apps/dominant_plane_segmentation.h +++ b/apps/include/pcl/apps/dominant_plane_segmentation.h @@ -33,8 +33,7 @@ * */ -#ifndef DOMINANT_PLANE_SEGMENTATION_H_ -#define DOMINANT_PLANE_SEGMENTATION_H_ +#pragma once #include #include @@ -66,10 +65,10 @@ namespace pcl class PCL_EXPORTS DominantPlaneSegmentation { public: - typedef pcl::PointCloud Cloud; - typedef typename Cloud::Ptr CloudPtr; - typedef typename Cloud::ConstPtr CloudConstPtr; - typedef typename pcl::search::KdTree::Ptr KdTreePtr; + using Cloud = pcl::PointCloud; + using CloudPtr = typename Cloud::Ptr; + using CloudConstPtr = typename Cloud::ConstPtr; + using KdTreePtr = typename pcl::search::KdTree::Ptr; DominantPlaneSegmentation () { @@ -228,17 +227,14 @@ namespace pcl { if (p1.intensity == 0) //new label return 1; - else + //compute distance and check against max_dist + if ((p1.getVector3fMap () - p2.getVector3fMap ()).norm () <= max_dist) { - //compute distance and check against max_dist - if ((p1.getVector3fMap () - p2.getVector3fMap ()).norm () <= max_dist) - { - p2.intensity = p1.intensity; - return 0; - } - else //new label - return 1; + p2.intensity = p1.intensity; + return 0; } + //new label + return 1; } //components needed for cluster segmentation and plane extraction @@ -286,5 +282,3 @@ namespace pcl #ifdef PCL_NO_PRECOMPILE #include #endif - -#endif /* DOMINANT_PLANE_SEGMENTATION_H_ */ diff --git a/apps/include/pcl/apps/face_detection/face_detection_apps_utils.h b/apps/include/pcl/apps/face_detection/face_detection_apps_utils.h index 4d1dfe8a..549e05be 100644 --- a/apps/include/pcl/apps/face_detection/face_detection_apps_utils.h +++ b/apps/include/pcl/apps/face_detection/face_detection_apps_utils.h @@ -5,12 +5,11 @@ * Author: ari */ -#ifndef FACE_DETECTION_APPS_UTILS_H_ -#define FACE_DETECTION_APPS_UTILS_H_ +#pragma once namespace face_detection_apps_utils { - inline bool readMatrixFromFile(std::string file, Eigen::Matrix4f & matrix) + inline bool readMatrixFromFile(const std::string& file, Eigen::Matrix4f & matrix) { std::ifstream in; @@ -55,8 +54,8 @@ namespace face_detection_apps_utils std::string id_1 = strs1[strs1.size () - 1]; std::string id_2 = strs2[strs2.size () - 1]; - size_t pos1 = id_1.find (".pcd"); - size_t pos2 = id_2.find (".pcd"); + std::size_t pos1 = id_1.find (".pcd"); + std::size_t pos2 = id_2.find (".pcd"); id_1 = id_1.substr (0, pos1); id_2 = id_2.substr (0, pos2); @@ -68,41 +67,26 @@ namespace face_detection_apps_utils inline void getFilesInDirectory(bf::path & dir, std::string & rel_path_so_far, std::vector & relative_paths, std::string & ext) { - bf::directory_iterator end_itr; - for (bf::directory_iterator itr (dir); itr != end_itr; ++itr) + for (const auto& dir_entry : bf::directory_iterator(dir)) { //check if its a directory, then get models in it - if (bf::is_directory (*itr)) + if (bf::is_directory (dir_entry)) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string so_far = rel_path_so_far + (itr->path().filename()).string() + "/"; -#else - std::string so_far = rel_path_so_far + (itr->path ()).filename () + "/"; -#endif + std::string so_far = rel_path_so_far + (dir_entry.path().filename()).string() + "/"; - bf::path curr_path = itr->path (); + bf::path curr_path = dir_entry.path (); getFilesInDirectory (curr_path, so_far, relative_paths, ext); } else { //check that it is a ply file and then add, otherwise ignore.. std::vector < std::string > strs; -#if BOOST_FILESYSTEM_VERSION == 3 - std::string file = (itr->path().filename()).string(); -#else - std::string file = (itr->path ()).filename (); -#endif - + std::string file = (dir_entry.path().filename()).string(); boost::split (strs, file, boost::is_any_of (".")); std::string extension = strs[strs.size () - 1]; - if (extension.compare (ext) == 0) + if (extension == ext) { -#if BOOST_FILESYSTEM_VERSION == 3 - std::string path = rel_path_so_far + (itr->path().filename()).string(); -#else - std::string path = rel_path_so_far + (itr->path ()).filename (); -#endif - + std::string path = rel_path_so_far + (dir_entry.path().filename()).string(); relative_paths.push_back (path); } } @@ -111,7 +95,7 @@ namespace face_detection_apps_utils void displayHeads(std::vector & heads, pcl::visualization::PCLVisualizer & vis) { - for (size_t i = 0; i < heads.size (); i++) + for (std::size_t i = 0; i < heads.size (); i++) { std::stringstream name; name << "sphere" << i; @@ -145,5 +129,3 @@ namespace face_detection_apps_utils } } } - -#endif /* FACE_DETECTION_APPS_UTILS_H_ */ diff --git a/apps/include/pcl/apps/face_detection/openni_frame_source.h b/apps/include/pcl/apps/face_detection/openni_frame_source.h index 1ef7b0c9..e8d54009 100644 --- a/apps/include/pcl/apps/face_detection/openni_frame_source.h +++ b/apps/include/pcl/apps/face_detection/openni_frame_source.h @@ -1,16 +1,17 @@ -#ifndef OPENNI_CAPTURE_H -#define OPENNI_CAPTURE_H +#pragma once #include #include +#include + namespace OpenNIFrameSource { - typedef pcl::PointXYZRGBA PointT; - typedef pcl::PointCloud PointCloud; - typedef pcl::PointCloud::Ptr PointCloudPtr; - typedef pcl::PointCloud::ConstPtr PointCloudConstPtr; + using PointT = pcl::PointXYZRGBA; + using PointCloud = pcl::PointCloud; + using PointCloudPtr = pcl::PointCloud::Ptr; + using PointCloudConstPtr = pcl::PointCloud::ConstPtr; /* A simple class for capturing data from an OpenNI camera */ class PCL_EXPORTS OpenNIFrameSource @@ -33,10 +34,8 @@ namespace OpenNIFrameSource pcl::OpenNIGrabber grabber_; PointCloudPtr most_recent_frame_; int frame_counter_; - boost::mutex mutex_; + std::mutex mutex_; bool active_; }; } - -#endif diff --git a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp index 2a3fe5bc..e01d057c 100644 --- a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp +++ b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp @@ -33,13 +33,6 @@ * */ -#ifndef Q_MOC_RUN -#pragma once -#include -#include -#endif - -#include #include #include #include @@ -109,7 +102,7 @@ pcl::apps::DominantPlaneSegmentation::compute_table_plane () seg_.setInputNormals (cloud_normals_); seg_.segment (*table_inliers_, *table_coefficients_); - if (table_inliers_->indices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -239,7 +232,7 @@ pcl::apps::DominantPlaneSegmentation::compute_fast (std::vectorindices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -305,10 +298,8 @@ pcl::apps::DominantPlaneSegmentation::compute_fast (std::vectorpoints.resize (input_->points.size ()); binary_cloud->is_dense = input_->is_dense; - size_t idx; - for (size_t i = 0; i < cloud_object_indices.indices.size (); ++i) + for (const int &idx : cloud_object_indices.indices) { - idx = cloud_object_indices.indices[i]; binary_cloud->points[idx].getVector4fMap () = input_->points[idx].getVector4fMap (); binary_cloud->points[idx].intensity = 1.0; } @@ -514,18 +505,17 @@ pcl::apps::DominantPlaneSegmentation::compute_fast (std::vector::iterator it_indices; int k = 0; - for (it_indices = clusters_map.begin (); it_indices != clusters_map.end (); it_indices++) + for (const auto &cluster : clusters_map) { - if (int ((*it_indices).second.indices.size ()) >= object_cluster_min_size_) + if (int (cluster.second.indices.size ()) >= object_cluster_min_size_) { clusters[k] = CloudPtr (new Cloud ()); - pcl::copyPointCloud (*input_, (*it_indices).second.indices, *clusters[k]); + pcl::copyPointCloud (*input_, cluster.second.indices, *clusters[k]); k++; - indices_clusters_.push_back((*it_indices).second); + indices_clusters_.push_back(cluster.second); } } @@ -615,7 +605,7 @@ pcl::apps::DominantPlaneSegmentation::compute (std::vector seg_.setInputNormals (cloud_normals_); seg_.segment (*table_inliers_, *table_coefficients_); - if (table_inliers_->indices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -672,7 +662,7 @@ pcl::apps::DominantPlaneSegmentation::compute (std::vector extract_object_indices.setIndices (boost::make_shared (cloud_object_indices)); extract_object_indices.filter (*cloud_objects_); - if (cloud_objects_->points.size () == 0) + if (cloud_objects_->points.empty ()) return; //down_.reset(new Cloud(*cloud_downsampled_)); @@ -688,7 +678,7 @@ pcl::apps::DominantPlaneSegmentation::compute (std::vector clusters.resize (clusters2.size ()); - for (size_t i = 0; i < clusters2.size (); ++i) + for (std::size_t i = 0; i < clusters2.size (); ++i) { clusters[i] = CloudPtr (new Cloud ()); pcl::copyPointCloud (*cloud_downsampled_, clusters2[i].indices, *clusters[i]); @@ -778,7 +768,7 @@ pcl::apps::DominantPlaneSegmentation::compute_full (std::vectorindices.size () == 0) + if (table_inliers_->indices.empty ()) { PCL_WARN ("[DominantPlaneSegmentation] No Plane Inliers points! Aborting."); return; @@ -835,7 +825,7 @@ pcl::apps::DominantPlaneSegmentation::compute_full (std::vector (cloud_object_indices)); extract_object_indices.filter (*cloud_objects_); - if (cloud_objects_->points.size () == 0) + if (cloud_objects_->points.empty ()) return; // ---[ Split the objects into Euclidean clusters @@ -849,7 +839,7 @@ pcl::apps::DominantPlaneSegmentation::compute_full (std::vector -// QT4 +// QT #include #include #include -// Boost -#ifndef Q_MOC_RUN -#include -#endif - // PCL #include #include @@ -66,7 +61,7 @@ #include -typedef pcl::PointXYZRGBA PointT; +using PointT = pcl::PointXYZRGBA; // Useful macros #define FPS_CALC(_WHAT_) \ @@ -93,9 +88,9 @@ class ManualRegistration : public QMainWindow { Q_OBJECT public: - typedef pcl::PointCloud Cloud; - typedef Cloud::Ptr CloudPtr; - typedef Cloud::ConstPtr CloudConstPtr; + using Cloud = pcl::PointCloud; + using CloudPtr = Cloud::Ptr; + using CloudConstPtr = Cloud::ConstPtr; ManualRegistration (); @@ -106,13 +101,13 @@ class ManualRegistration : public QMainWindow void setSrcCloud (pcl::PointCloud::Ptr cloud_src) { - cloud_src_ = cloud_src; + cloud_src_ = std::move(cloud_src); cloud_src_present_ = true; } void setDstCloud (pcl::PointCloud::Ptr cloud_dst) { - cloud_dst_ = cloud_dst; + cloud_dst_ = std::move(cloud_dst); cloud_dst_present_ = true; } @@ -122,8 +117,8 @@ class ManualRegistration : public QMainWindow DstPointPickCallback (const pcl::visualization::PointPickingEvent& event, void*); protected: - boost::shared_ptr vis_src_; - boost::shared_ptr vis_dst_; + pcl::visualization::PCLVisualizer::Ptr vis_src_; + pcl::visualization::PCLVisualizer::Ptr vis_dst_; pcl::PointCloud::Ptr cloud_src_; pcl::PointCloud::Ptr cloud_dst_; diff --git a/apps/include/pcl/apps/nn_classification.h b/apps/include/pcl/apps/nn_classification.h index 0e4324ad..827d8208 100644 --- a/apps/include/pcl/apps/nn_classification.h +++ b/apps/include/pcl/apps/nn_classification.h @@ -37,15 +37,12 @@ * */ -#ifndef NNCLASSIFICATION_H_ -#define NNCLASSIFICATION_H_ +#pragma once #include #include #include #include -#include -#include namespace pcl { @@ -69,11 +66,11 @@ namespace pcl public: - NNClassification () : tree_ (), classes_ (), labels_idx_ () {} + NNClassification () : tree_ () {} /** \brief Result is a list of class labels and scores */ - typedef std::pair, std::vector > Result; - typedef boost::shared_ptr ResultPtr; + using Result = std::pair, std::vector >; + using ResultPtr = std::shared_ptr; // TODO setIndices method, distance metrics and reset tree @@ -118,15 +115,17 @@ namespace pcl // Save the mapping from labels to indices in the class list std::map label2idx; - for (std::vector::const_iterator it = classes_.begin (); it != classes_.end (); it++) - label2idx[*it] = int (it - classes_.begin ()); + for (std::size_t i = 0; i < classes_.size(); ++i) + { + label2idx[classes_[i]] = i; + } // Create a list holding the class index of each label labels_idx_.reserve (labels.size ()); - BOOST_FOREACH (std::string s, labels) + for (const auto &s : labels) + { labels_idx_.push_back (label2idx[s]); -// for (std::vector::const_iterator it = labels.begin (); it != labels.end (); it++) -// labels_idx_.push_back (label2idx[*it]); + } } /** \brief Load the list of training examples and corresponding labels. @@ -135,16 +134,16 @@ namespace pcl * \return true on success, false on failure (read error or number of entries don't match) */ bool - loadTrainingFeatures(std::string file_name, std::string labels_file_name) + loadTrainingFeatures(const std::string& file_name, const std::string& labels_file_name) { typename pcl::PointCloud::Ptr cloud (new pcl::PointCloud); - if (pcl::io::loadPCDFile (file_name.c_str (), *cloud) != 0) + if (pcl::io::loadPCDFile (file_name, *cloud) != 0) return (false); std::vector labels; std::ifstream f (labels_file_name.c_str ()); std::string label; while (getline (f, label)) - if (label.size () > 0) + if (!label.empty ()) labels.push_back(label); if (labels.size () != cloud->points.size ()) return (false); @@ -159,7 +158,7 @@ namespace pcl * \return true on success, false on failure (write error or number of entries don't match) */ bool - saveTrainingFeatures (std::string file_name, std::string labels_file_name) + saveTrainingFeatures (const std::string& file_name, const std::string& labels_file_name) { typename pcl::PointCloud::ConstPtr training_features = tree_->getInputCloud (); if (labels_idx_.size () == training_features->points.size ()) @@ -167,8 +166,10 @@ namespace pcl if (pcl::io::savePCDFile (file_name.c_str (), *training_features) != 0) return (false); std::ofstream f (labels_file_name.c_str ()); - BOOST_FOREACH (int i, labels_idx_) + for (const int& i : labels_idx_) + { f << classes_[i] << "\n"; + } return (true); } return (false); @@ -226,11 +227,11 @@ namespace pcl * \param k_sqr_distances the resultant squared distances to the neighboring points * \return a square distance to each training class */ - boost::shared_ptr > + std::shared_ptr> getSmallestSquaredDistances (std::vector &k_indices, std::vector &k_sqr_distances) { // Reserve space for distances - boost::shared_ptr > sqr_distances (new std::vector (classes_.size (), FLT_MAX)); + auto sqr_distances = std::make_shared> (classes_.size (), FLT_MAX); // Select square distance to each class for (std::vector::const_iterator i = k_indices.begin (); i != k_indices.end (); ++i) @@ -249,11 +250,11 @@ namespace pcl getLinearBestScores (std::vector &k_indices, std::vector &k_sqr_distances) { // Get smallest squared distances and transform them to a score for each class - boost::shared_ptr > sqr_distances = getSmallestSquaredDistances (k_indices, k_sqr_distances); + auto sqr_distances = getSmallestSquaredDistances (k_indices, k_sqr_distances); // Transform distances to scores double sum_dist = 0; - boost::shared_ptr, std::vector > > result (new std::pair, std::vector > ()); + auto result = std::make_shared, std::vector>> (); result->first.reserve (classes_.size ()); result->second.reserve (classes_.size ()); for (std::vector::const_iterator it = sqr_distances->begin (); it != sqr_distances->end (); ++it) @@ -263,8 +264,8 @@ namespace pcl result->second.push_back (sqrt (*it)); sum_dist += result->second.back (); } - for (std::vector::iterator it = result->second.begin (); it != result->second.end (); ++it) - *it = 1 - *it/sum_dist; + for (float &it : result->second) + it = 1 - it/sum_dist; // Return label/score list pair return (result); @@ -280,10 +281,10 @@ namespace pcl getGaussianBestScores (float gaussian_param, std::vector &k_indices, std::vector &k_sqr_distances) { // Get smallest squared distances and transform them to a score for each class - boost::shared_ptr > sqr_distances = getSmallestSquaredDistances (k_indices, k_sqr_distances); + auto sqr_distances = getSmallestSquaredDistances (k_indices, k_sqr_distances); // Transform distances to scores - boost::shared_ptr, std::vector > > result (new std::pair, std::vector > ()); + auto result = std::make_shared, std::vector>> (); result->first.reserve (classes_.size ()); result->second.reserve (classes_.size ()); for (std::vector::const_iterator it = sqr_distances->begin (); it != sqr_distances->end (); ++it) @@ -291,7 +292,7 @@ namespace pcl { result->first.push_back (classes_[it - sqr_distances->begin ()]); // TODO leave it squared, and relate param to sigma... - result->second.push_back (expf (-std::sqrt (*it) / gaussian_param)); + result->second.push_back (std::exp (-std::sqrt (*it) / gaussian_param)); } // Return label/score list pair @@ -299,5 +300,3 @@ namespace pcl } }; } - -#endif /* NNCLASSIFICATION_H_ */ diff --git a/apps/include/pcl/apps/openni_passthrough.h b/apps/include/pcl/apps/openni_passthrough.h index b70aecaa..5bf7b2fa 100644 --- a/apps/include/pcl/apps/openni_passthrough.h +++ b/apps/include/pcl/apps/openni_passthrough.h @@ -35,8 +35,7 @@ * */ -#ifndef PCL_APPS_OPENNI_PASSTHROUGH_3D_ -#define PCL_APPS_OPENNI_PASSTHROUGH_3D_ +#pragma once // PCL #include @@ -73,9 +72,9 @@ class OpenNIPassthrough : public QMainWindow { Q_OBJECT public: - typedef pcl::PointCloud Cloud; - typedef Cloud::Ptr CloudPtr; - typedef Cloud::ConstPtr CloudConstPtr; + using Cloud = pcl::PointCloud; + using CloudPtr = Cloud::Ptr; + using CloudConstPtr = Cloud::ConstPtr; OpenNIPassthrough (pcl::OpenNIGrabber& grabber); @@ -89,7 +88,7 @@ class OpenNIPassthrough : public QMainWindow cloud_cb (const CloudConstPtr& cloud); protected: - boost::shared_ptr vis_; + pcl::visualization::PCLVisualizer::Ptr vis_; pcl::OpenNIGrabber& grabber_; std::string device_id_; CloudPtr cloud_pass_; @@ -116,5 +115,3 @@ class OpenNIPassthrough : public QMainWindow void valueChanged (int new_value); }; - -#endif // PCL_APPS_OPENNI_PASSTHROUGH_3D_ diff --git a/apps/include/pcl/apps/openni_passthrough_qt.h b/apps/include/pcl/apps/openni_passthrough_qt.h index 86805ad8..cdb8f010 100644 --- a/apps/include/pcl/apps/openni_passthrough_qt.h +++ b/apps/include/pcl/apps/openni_passthrough_qt.h @@ -35,8 +35,7 @@ * */ -#ifndef PCL_APPS_OPENNI_PASSTHROUGH_QT_ -#define PCL_APPS_OPENNI_PASSTHROUGH_QT_ +#pragma once #ifdef __GNUC__ #pragma GCC system_header @@ -48,5 +47,3 @@ #include #include #include - -#endif // PCL_APPS_OPENNI_PASSTHROUGH_QT_ diff --git a/apps/include/pcl/apps/organized_segmentation_demo.h b/apps/include/pcl/apps/organized_segmentation_demo.h index 2d873a34..95e6935e 100644 --- a/apps/include/pcl/apps/organized_segmentation_demo.h +++ b/apps/include/pcl/apps/organized_segmentation_demo.h @@ -1,15 +1,15 @@ /* * Software License Agreement (BSD License) - * + * * Point Cloud Library (PCL) - www.pointclouds.org * Copyright (c) 2012-, Open Perception, Inc. - * + * * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions - * are met: - * + * are met: + * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -19,7 +19,7 @@ * * Neither the name of the copyright holder(s) nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -34,13 +34,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PCL_ORGANIZED_SEGMENTATION_DEMO_H_ -#define PCL_ORGANIZED_SEGMENTATION_DEMO_H_ +#pragma once #include -// Boost -#include // PCL #include #include @@ -62,7 +59,7 @@ #include #include -typedef pcl::PointXYZRGBA PointT; +using PointT = pcl::PointXYZRGBA; // Useful macros #define FPS_CALC(_WHAT_) \ @@ -89,10 +86,10 @@ class OrganizedSegmentationDemo : public QMainWindow { Q_OBJECT public: - typedef pcl::PointCloud Cloud; - typedef Cloud::Ptr CloudPtr; - typedef Cloud::ConstPtr CloudConstPtr; - + using Cloud = pcl::PointCloud; + using CloudPtr = Cloud::Ptr; + using CloudConstPtr = Cloud::ConstPtr; + OrganizedSegmentationDemo(pcl::Grabber& grabber); @@ -101,11 +98,11 @@ class OrganizedSegmentationDemo : public QMainWindow if(grabber_.isRunning()) grabber_.stop(); } - + void cloud_cb (const CloudConstPtr& cloud); - + protected: - boost::shared_ptr vis_; + pcl::visualization::PCLVisualizer::Ptr vis_; pcl::Grabber& grabber_; QMutex mtx_; @@ -116,16 +113,16 @@ class OrganizedSegmentationDemo : public QMainWindow pcl::PointCloud prev_normals_; std::vector, Eigen::aligned_allocator > > prev_regions_; float* prev_distance_map_; - + pcl::PointCloud::CloudVectorType prev_clusters_; - + pcl::IntegralImageNormalEstimation ne; pcl::OrganizedMultiPlaneSegmentation mps; bool capture_; bool data_modified_; - size_t previous_data_size_; - size_t previous_clusters_size_; + std::size_t previous_data_size_; + std::size_t previous_clusters_size_; bool display_normals_; bool display_curvature_; @@ -151,16 +148,16 @@ class OrganizedSegmentationDemo : public QMainWindow void useEuclideanComparatorPressed (); void useRGBComparatorPressed (); void useEdgeAwareComparatorPressed (); - + void displayCurvaturePressed (); void displayDistanceMapPressed (); void displayNormalsPressed (); - + void disableRefinementPressed () { use_planar_refinement_ = false; } - + void usePlanarRefinementPressed () { use_planar_refinement_ = true; @@ -175,12 +172,10 @@ class OrganizedSegmentationDemo : public QMainWindow { use_clustering_ = true; } - + private Q_SLOTS: void timeoutSlot(); }; - -#endif // PCL_ORGANIZED_SEGMENTATION_DEMO_H_ diff --git a/apps/include/pcl/apps/organized_segmentation_demo_qt.h b/apps/include/pcl/apps/organized_segmentation_demo_qt.h index 9dbc8446..218ad679 100644 --- a/apps/include/pcl/apps/organized_segmentation_demo_qt.h +++ b/apps/include/pcl/apps/organized_segmentation_demo_qt.h @@ -34,8 +34,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PCL_ORGANIZED_SEGMENTATION_DEMO_QT_H_ -#define PCL_ORGANIZED_SEGMENTATION_DEMO_QT_H_ +#pragma once #ifdef __GNUC__ #pragma GCC system_header @@ -46,5 +45,3 @@ #include #include #include - -#endif // PCL_ORGANIZED_SEGMENTATION_DEMO_QT_H_ diff --git a/apps/include/pcl/apps/pcd_video_player.h b/apps/include/pcl/apps/pcd_video_player.h index 59afa0b5..a8c3d17e 100644 --- a/apps/include/pcl/apps/pcd_video_player.h +++ b/apps/include/pcl/apps/pcd_video_player.h @@ -37,7 +37,7 @@ #include #include -#include +#include // QT4 #include @@ -45,7 +45,6 @@ #include // Boost -#include #include // PCL @@ -95,16 +94,16 @@ class PCDVideoPlayer : public QMainWindow { Q_OBJECT public: - typedef pcl::PointCloud Cloud; - typedef Cloud::Ptr CloudPtr; - typedef Cloud::ConstPtr CloudConstPtr; + using Cloud = pcl::PointCloud; + using CloudPtr = Cloud::Ptr; + using CloudConstPtr = Cloud::ConstPtr; PCDVideoPlayer (); ~PCDVideoPlayer () {} protected: - boost::shared_ptr vis_; + pcl::visualization::PCLVisualizer::Ptr vis_; pcl::PointCloud::Ptr cloud_; QMutex mtx_; diff --git a/apps/include/pcl/apps/render_views_tesselated_sphere.h b/apps/include/pcl/apps/render_views_tesselated_sphere.h index a311046e..4d0376af 100644 --- a/apps/include/pcl/apps/render_views_tesselated_sphere.h +++ b/apps/include/pcl/apps/render_views_tesselated_sphere.h @@ -5,13 +5,14 @@ * Author: aitor */ -#ifndef RENDER_VIEWS_TESSELATED_SPHERE_H_ -#define RENDER_VIEWS_TESSELATED_SPHERE_H_ +#pragma once + +#include #include #include -#include -#include + +#include namespace pcl { @@ -38,7 +39,7 @@ namespace pcl bool compute_entropy_; vtkSmartPointer polydata_; bool gen_organized_; - boost::function campos_constraints_func_; struct camPosConstraintsAllTrue @@ -65,7 +66,7 @@ namespace pcl } void - setCamPosConstraints (boost::function & bb) + setCamPosConstraints (std::function & bb) { campos_constraints_func_ = bb; } @@ -178,5 +179,3 @@ namespace pcl } } - -#endif /* RENDER_VIEWS_TESSELATED_SPHERE_H_ */ diff --git a/apps/include/pcl/apps/timer.h b/apps/include/pcl/apps/timer.h index 00f6bf15..630a22e9 100644 --- a/apps/include/pcl/apps/timer.h +++ b/apps/include/pcl/apps/timer.h @@ -37,8 +37,7 @@ * */ -#ifndef PCL_APPS_TIMER_H_ -#define PCL_APPS_TIMER_H_ +#pragma once #define MEASURE_FUNCTION_TIME #include //fps calculations @@ -64,5 +63,3 @@ do \ { \ }while(false) #endif - -#endif // PCL_APPS_TIMER_H_ diff --git a/apps/include/pcl/apps/vfh_nn_classifier.h b/apps/include/pcl/apps/vfh_nn_classifier.h index dec66611..944d82c9 100644 --- a/apps/include/pcl/apps/vfh_nn_classifier.h +++ b/apps/include/pcl/apps/vfh_nn_classifier.h @@ -35,8 +35,7 @@ * */ -#ifndef VFHCLASSIFICATION_H_ -#define VFHCLASSIFICATION_H_ +#pragma once #include #include @@ -94,11 +93,11 @@ namespace pcl { public: - typedef pcl::PointCloud FeatureCloud; - typedef pcl::PointCloud::Ptr FeatureCloudPtr; - typedef pcl::PointCloud::ConstPtr FeatureCloudConstPtr; - typedef NNClassification::Result Result; - typedef NNClassification::ResultPtr ResultPtr; + using FeatureCloud = pcl::PointCloud; + using FeatureCloudPtr = pcl::PointCloud::Ptr; + using FeatureCloudConstPtr = pcl::PointCloud::ConstPtr; + using Result = NNClassification::Result; + using ResultPtr = NNClassification::ResultPtr; private: @@ -111,7 +110,7 @@ namespace pcl public: - VFHClassifierNN () : training_features_ (), labels_ (), classifier_ () + VFHClassifierNN () { reset (); } @@ -147,15 +146,17 @@ namespace pcl * \param labels_file_name file name for writing the class label for each training example * \return true on success, false on failure (write error or number of entries don't match) */ - bool saveTrainingFeatures(std::string file_name, std::string labels_file_name) + bool saveTrainingFeatures(const std::string& file_name, const std::string& labels_file_name) { if (labels_.size () == training_features_->points.size ()) { - if (pcl::io::savePCDFile (file_name.c_str (), *training_features_) != 0) + if (pcl::io::savePCDFile (file_name, *training_features_) != 0) return false; std::ofstream f (labels_file_name.c_str ()); - BOOST_FOREACH (std::string s, labels_) + for (const auto& s : labels_) + { f << s << "\n"; + } return true; } return false; @@ -167,7 +168,7 @@ namespace pcl * \param labels the class label for each training example * \return true on success, false on failure (number of entries don't match) */ - bool addTrainingFeatures (const FeatureCloudPtr training_features, const std::vector &labels) + bool addTrainingFeatures (const FeatureCloudPtr& training_features, const std::vector &labels) { if (labels.size () == training_features->points.size ()) { @@ -175,7 +176,7 @@ namespace pcl training_features_->points.insert (training_features_->points.end (), training_features->points.begin (), training_features->points.end ()); training_features_->header = training_features->header; training_features_->height = 1; - training_features_->width = static_cast (training_features_->points.size ()); + training_features_->width = static_cast (training_features_->points.size ()); training_features_->is_dense &= training_features->is_dense; training_features_->sensor_origin_ = training_features->sensor_origin_; training_features_->sensor_orientation_ = training_features->sensor_orientation_; @@ -190,16 +191,16 @@ namespace pcl * \param labels_file_name the class label for each training example * \return true on success, false on failure (read error or number of entries don't match) */ - bool loadTrainingFeatures(std::string file_name, std::string labels_file_name) + bool loadTrainingFeatures(const std::string& file_name, const std::string& labels_file_name) { FeatureCloudPtr cloud (new FeatureCloud); - if (pcl::io::loadPCDFile (file_name.c_str (), *cloud) != 0) + if (pcl::io::loadPCDFile (file_name, *cloud) != 0) return false; std::vector labels; std::ifstream f (labels_file_name.c_str ()); std::string label; while (getline (f, label)) - if (label.size () > 0) + if (!label.empty ()) labels.push_back(label); return addTrainingFeatures (cloud, labels); } @@ -211,10 +212,10 @@ namespace pcl * \param label the class label for the training example * \return true on success, false on failure (read error or number of entries don't match) */ - bool loadTrainingData (std::string file_name, std::string label) + bool loadTrainingData (const std::string& file_name, std::string label) { pcl::PCLPointCloud2 cloud_blob; - if (pcl::io::loadPCDFile (file_name.c_str (), cloud_blob) != 0) + if (pcl::io::loadPCDFile (file_name, cloud_blob) != 0) return false; return addTrainingData (cloud_blob, label); } @@ -247,7 +248,7 @@ namespace pcl // compute the VFH feature for this point cloud FeatureCloudPtr vfhs = computeFeature (testing_data); // compute gaussian parameter producing the desired minimum score (around 50 for the default values) - float gaussian_param = - static_cast (radius / log (min_score)); + float gaussian_param = - static_cast (radius / std::log (min_score)); // TODO accept result to be filled in by reference return classifier_.classify(vfhs->points.at (0), radius, gaussian_param); } @@ -265,5 +266,3 @@ namespace pcl } }; } - -#endif /* VFHCLASSIFICATION_H_ */ diff --git a/apps/modeler/CMakeLists.txt b/apps/modeler/CMakeLists.txt index 6424d3f8..7b1d14b5 100644 --- a/apps/modeler/CMakeLists.txt +++ b/apps/modeler/CMakeLists.txt @@ -7,33 +7,33 @@ set(REASON "") if(NOT VTK_FOUND) set(DEFAULT AUTO_OFF) set(REASON "VTK was not found.") -else(NOT VTK_FOUND) +else() set(DEFAULT TRUE) set(REASON) set(VTK_USE_FILE "${VTK_USE_FILE}" CACHE INTERNAL "VTK_USE_FILE") include("${VTK_USE_FILE}") -endif(NOT VTK_FOUND) +endif() -# QT4 Found? -if(NOT QT4_FOUND) +# QT5 Found? +if(NOT Qt5_FOUND) set(DEFAULT AUTO_OFF) - set(REASON "Qt4 was not found.") + set(REASON "Qt5 was not found.") elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") set(DEFAULT TRUE) set(REASON) -endif(NOT QT4_FOUND) +endif() # QVTK? -if(NOT VTK_USE_QVTK) +if(NOT QVTK_FOUND) set(DEFAULT AUTO_OFF) set(REASON "VTK was not built with Qt support.") elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") set(DEFAULT TRUE) set(REASON) -endif(NOT VTK_USE_QVTK) +endif() # Default to not building for now -if (${DEFAULT} STREQUAL "TRUE") +if(${DEFAULT} STREQUAL "TRUE") set(DEFAULT FALSE) endif() @@ -42,103 +42,116 @@ PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSYS_DE PCL_ADD_DOC("${SUBSUBSYS_NAME}") -if(build) - include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") - - # Set Qt files and resources here - set(uis main_window.ui) - set(moc_incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/main_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/scene_tree.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/parameter_dialog.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/thread_controller.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/abstract_worker.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_mesh_item_updater.h") - - set(resources resources/resources.qrc) - - set(incs ${moc_incs} - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/qt.h" - - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/dock_widget.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/abstract_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/render_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/render_window_item.h" - - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/parameter.h" - - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_mesh.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_mesh_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/channel_actor_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/points_actor_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/normals_actor_item.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/surface_actor_item.h" - - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/icp_registration_worker.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/voxel_grid_downsample_worker.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/statistical_outlier_removal_worker.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/normal_estimation_worker.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/poisson_worker.h") - - set(srcs src/main.cpp - - src/main_window.cpp - src/dock_widget.cpp - src/abstract_item.cpp - src/render_window.cpp - src/render_window_item.cpp - - src/parameter.cpp - src/parameter_dialog.cpp - - src/scene_tree.cpp - - src/cloud_mesh.cpp - src/cloud_mesh_item.cpp - src/cloud_mesh_item_updater.cpp - src/channel_actor_item.cpp - src/points_actor_item.cpp - src/normals_actor_item.cpp - src/surface_actor_item.cpp - - src/thread_controller.cpp - src/abstract_worker.cpp - src/icp_registration_worker.cpp - src/voxel_grid_downsample_worker.cpp - src/statistical_outlier_removal_worker.cpp - src/normal_estimation_worker.cpp - src/poisson_worker.cpp) - - set(impl_incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/parameter.hpp" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/scene_tree.hpp") - - # Qt stuff - QT4_WRAP_UI(ui_srcs ${uis}) - QT4_WRAP_CPP(moc_srcs ${moc_incs} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) - QT4_ADD_RESOURCES(resource_srcs ${resources}) - - # Organize files - SOURCE_GROUP("Resources" FILES ${uis} ${resources} ${EXE_ICON}) - SOURCE_GROUP("Generated" FILES ${ui_srcs} ${moc_srcs} ${resource_srcs} ${RCS_SOURCES}) - SET_SOURCE_FILES_PROPERTIES(${srcs} PROPERTIES OBJECT_DEPENDS "${ui_srcs}") - - # Generate executable - set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") - PCL_ADD_EXECUTABLE("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${ui_srcs} ${moc_srcs} ${resource_srcs} ${srcs} ${incs} ${impl_incs}) - target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_kdtree pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search ${QVTK_LIBRARY} ${QT_LIBRARIES}) - - # Put the ui in the windows project file - IF("${CMAKE_BUILD_TOOL}" MATCHES "msdev") - LIST(APPEND srcs ${uis}) - ELSEIF("${CMAKE_BUILD_TOOL}" MATCHES "devenv") - LIST(APPEND srcs ${uis}) - ENDIF("${CMAKE_BUILD_TOOL}" MATCHES "msdev") - - # Install include files - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${incs}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${impl_incs}) - - PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "") - - add_subdirectory(tools) - -endif(build) +if(NOT build) + return() +endif() + +include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") + +# Set Qt files and resources here +set(uis + main_window.ui +) + +set(moc_incs + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/main_window.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/scene_tree.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/parameter_dialog.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/thread_controller.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/abstract_worker.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_mesh_item_updater.h" +) + +set(resources + resources/resources.qrc +) + +set(incs + ${moc_incs} + + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/dock_widget.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/abstract_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/render_window.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/render_window_item.h" + + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/parameter.h" + + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_mesh.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_mesh_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/channel_actor_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/points_actor_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/normals_actor_item.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/surface_actor_item.h" + + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/icp_registration_worker.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/voxel_grid_downsample_worker.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/statistical_outlier_removal_worker.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/normal_estimation_worker.h" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/poisson_worker.h" +) + +set(srcs + src/main.cpp + + src/main_window.cpp + src/dock_widget.cpp + src/abstract_item.cpp + src/render_window.cpp + src/render_window_item.cpp + + src/parameter.cpp + src/parameter_dialog.cpp + + src/scene_tree.cpp + + src/cloud_mesh.cpp + src/cloud_mesh_item.cpp + src/cloud_mesh_item_updater.cpp + src/channel_actor_item.cpp + src/points_actor_item.cpp + src/normals_actor_item.cpp + src/surface_actor_item.cpp + + src/thread_controller.cpp + src/abstract_worker.cpp + src/icp_registration_worker.cpp + src/voxel_grid_downsample_worker.cpp + src/statistical_outlier_removal_worker.cpp + src/normal_estimation_worker.cpp + src/poisson_worker.cpp +) + +set(impl_incs + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/parameter.hpp" + "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/impl/scene_tree.hpp" +) + +# Qt stuff +QT5_WRAP_UI(ui_srcs ${uis}) +QT5_WRAP_CPP(moc_srcs ${moc_incs} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) +QT5_ADD_RESOURCES(resource_srcs ${resources}) + +# Organize files +source_group("Resources" FILES ${uis} ${resources} ${EXE_ICON}) +source_group("Generated" FILES ${ui_srcs} ${moc_srcs} ${resource_srcs} ${RCS_SOURCES}) +set_source_files_properties(${srcs} PROPERTIES OBJECT_DEPENDS "${ui_srcs}") + +# Generate executable +set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") +PCL_ADD_EXECUTABLE(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} SOURCES ${ui_srcs} ${moc_srcs} ${resource_srcs} ${srcs} ${incs} ${impl_incs}) +target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_kdtree pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search Qt5::Widgets) + +# Put the ui in the windows project file +if(("${CMAKE_BUILD_TOOL}" MATCHES "msdev") OR("${CMAKE_BUILD_TOOL}" MATCHES "devenv")) + list(APPEND srcs ${uis}) +endif() + +# Install include files +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${incs}) +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${impl_incs}) + +PCL_MAKE_PKGCONFIG(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} DESC ${SUBSUBSYS_DESC}) + +# Add to the compound apps target +list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME}) +set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE) diff --git a/apps/modeler/include/pcl/apps/modeler/abstract_item.h b/apps/modeler/include/pcl/apps/modeler/abstract_item.h index 6d98737b..1db7e288 100755 --- a/apps/modeler/include/pcl/apps/modeler/abstract_item.h +++ b/apps/modeler/include/pcl/apps/modeler/abstract_item.h @@ -34,8 +34,7 @@ * */ -#ifndef PCL_MODELER_ABSTRACT_ITEM_H_ -#define PCL_MODELER_ABSTRACT_ITEM_H_ +#pragma once #include @@ -55,8 +54,8 @@ namespace pcl class AbstractItem { public: - AbstractItem(void); - ~AbstractItem(void); + AbstractItem(); + ~AbstractItem(); void showContextMenu(const QPoint* position); @@ -82,5 +81,3 @@ namespace pcl } } - -#endif // PCL_MODELER_ABSTRACT_ITEM_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/abstract_worker.h b/apps/modeler/include/pcl/apps/modeler/abstract_worker.h index 6c5ba319..0752b64c 100755 --- a/apps/modeler/include/pcl/apps/modeler/abstract_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/abstract_worker.h @@ -34,10 +34,9 @@ * */ -#ifndef PCL_MODELER_ABSTRACT_WORKER_H_ -#define PCL_MODELER_ABSTRACT_WORKER_H_ +#pragma once -#include +#include namespace pcl { @@ -51,8 +50,8 @@ namespace pcl Q_OBJECT public: - AbstractWorker(const QList& cloud_mesh_items, QWidget* parent=0); - ~AbstractWorker(void); + AbstractWorker(const QList& cloud_mesh_items, QWidget* parent=nullptr); + ~AbstractWorker(); int exec(); @@ -91,5 +90,3 @@ namespace pcl } } - -#endif // PCL_MODELER_ABSTRACT_WORKER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h b/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h index e7f6c39d..104d469d 100755 --- a/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h +++ b/apps/modeler/include/pcl/apps/modeler/channel_actor_item.h @@ -33,14 +33,16 @@ * * */ -#ifndef PCL_MODELER_CHANNEL_ACTOR_ITEM_H_ -#define PCL_MODELER_CHANNEL_ACTOR_ITEM_H_ + +#pragma once + +#include #include -#include + #include -#include #include +#include class vtkActor; class vtkPolyData; @@ -52,13 +54,11 @@ namespace pcl { namespace modeler { - class CloudMesh; - class ChannelActorItem : public QTreeWidgetItem, public AbstractItem { public: ChannelActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, + const CloudMesh::Ptr& cloud_mesh, const vtkSmartPointer& render_window, const vtkSmartPointer& actor, const std::string& channel_name); @@ -86,10 +86,10 @@ namespace pcl virtual void updateImpl() = 0; - virtual void - prepareContextMenu(QMenu* menu) const; + void + prepareContextMenu(QMenu* menu) const override; - boost::shared_ptr cloud_mesh_; + CloudMesh::Ptr cloud_mesh_; vtkSmartPointer poly_data_; vtkSmartPointer render_window_; std::string color_scheme_; @@ -100,5 +100,3 @@ namespace pcl }; } } - -#endif // PCL_MODELER_CHANNEL_ACTOR_ITEM_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/cloud_mesh.h b/apps/modeler/include/pcl/apps/modeler/cloud_mesh.h index c5929e67..c8dda9d7 100755 --- a/apps/modeler/include/pcl/apps/modeler/cloud_mesh.h +++ b/apps/modeler/include/pcl/apps/modeler/cloud_mesh.h @@ -33,8 +33,8 @@ * * */ -#ifndef PCL_MODELER_CLOUD_MESH_H_ -#define PCL_MODELER_CLOUD_MESH_H_ + +#pragma once #include #include @@ -52,10 +52,11 @@ namespace pcl class CloudMesh { public: - typedef pcl::PointSurfel PointT; - typedef pcl::PointCloud PointCloud; - typedef PointCloud::Ptr PointCloudPtr; - typedef PointCloud::ConstPtr PointCloudConstPtr; + using PointT = pcl::PointSurfel; + using PointCloud = pcl::PointCloud; + using PointCloudPtr = PointCloud::Ptr; + using PointCloudConstPtr = PointCloud::ConstPtr; + using Ptr = std::shared_ptr; CloudMesh (); CloudMesh (PointCloudPtr cloud); @@ -117,5 +118,3 @@ namespace pcl }; } } - -#endif // PCL_MODELER_CLOUD_MESH_H_ \ No newline at end of file diff --git a/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item.h b/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item.h index 5f6ea968..be4d4c56 100755 --- a/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item.h +++ b/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item.h @@ -33,11 +33,11 @@ * * */ -#ifndef PCL_MODELER_CLOUD_MESH_ITEM_H_ -#define PCL_MODELER_CLOUD_MESH_ITEM_H_ -#include -#include +#pragma once + +#include + #include #include @@ -56,12 +56,13 @@ namespace pcl CloudMeshItem(QTreeWidgetItem* parent, const CloudMeshItem& cloud_mesh_item); ~CloudMeshItem(); - inline boost::shared_ptr& + inline CloudMesh::Ptr& getCloudMesh() { return cloud_mesh_; } - inline const boost::shared_ptr& + + inline const CloudMesh::Ptr& getCloudMesh() const { return cloud_mesh_; @@ -79,25 +80,25 @@ namespace pcl void updateChannels(); - virtual std::string - getItemName() const {return "Cloud Mesh Item";} + std::string + getItemName() const override {return "Cloud Mesh Item";} void updateRenderWindow(); protected: - virtual void - prepareContextMenu(QMenu* menu) const; + void + prepareContextMenu(QMenu* menu) const override; - virtual void - prepareProperties(ParameterDialog* parameter_dialog); + void + prepareProperties(ParameterDialog* parameter_dialog) override; - virtual void - setProperties(); + void + setProperties() override; private: std::string filename_; - boost::shared_ptr cloud_mesh_; + CloudMesh::Ptr cloud_mesh_; DoubleParameter* translation_x_; DoubleParameter* translation_y_; @@ -108,5 +109,3 @@ namespace pcl }; } } - -#endif // PCL_MODELER_CLOUD_MESH_ITEM_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item_updater.h b/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item_updater.h index 2f297855..fb7c3e59 100755 --- a/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item_updater.h +++ b/apps/modeler/include/pcl/apps/modeler/cloud_mesh_item_updater.h @@ -33,10 +33,10 @@ * * */ -#ifndef PCL_MODELER_CLOUD_MESH_ITEM_UPDATER_H_ -#define PCL_MODELER_CLOUD_MESH_ITEM_UPDATER_H_ -#include +#pragma once + +#include namespace pcl { @@ -61,5 +61,3 @@ namespace pcl }; } } - -#endif // PCL_MODELER_CLOUD_MESH_ITEM_UPDATER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/dock_widget.h b/apps/modeler/include/pcl/apps/modeler/dock_widget.h index 280da304..be9ac2a9 100755 --- a/apps/modeler/include/pcl/apps/modeler/dock_widget.h +++ b/apps/modeler/include/pcl/apps/modeler/dock_widget.h @@ -34,10 +34,9 @@ * */ -#ifndef PCL_MODELER_DOCK_WIDGET_H_ -#define PCL_MODELER_DOCK_WIDGET_H_ +#pragma once -#include +#include namespace pcl { @@ -46,19 +45,17 @@ namespace pcl class DockWidget : public QDockWidget { public: - explicit DockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0); - explicit DockWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit DockWidget(const QString &title, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); + explicit DockWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); ~DockWidget(); void setFocusBasedStyle(bool focused); protected: - virtual void - focusInEvent ( QFocusEvent * event ); + void + focusInEvent ( QFocusEvent * event ) override; private: }; } } - -#endif // PCL_MODELER_DOCK_WIDGET_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h b/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h index 67330342..4fccd263 100755 --- a/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/icp_registration_worker.h @@ -34,8 +34,7 @@ * */ -#ifndef PCL_MODELER_ICP_REGISTRATION_WORKER_H_ -#define PCL_MODELER_ICP_REGISTRATION_WORKER_H_ +#pragma once #include #include @@ -50,21 +49,21 @@ namespace pcl class ICPRegistrationWorker : public AbstractWorker { public: - ICPRegistrationWorker(CloudMesh::PointCloudPtr cloud, const QList& cloud_mesh_items, QWidget* parent=0); - ~ICPRegistrationWorker(void); + ICPRegistrationWorker(CloudMesh::PointCloudPtr cloud, const QList& cloud_mesh_items, QWidget* parent=nullptr); + ~ICPRegistrationWorker(); protected: - virtual std::string - getName () const {return ("Normal Estimation");} + std::string + getName () const override {return ("Normal Estimation");} - virtual void - initParameters(CloudMeshItem* cloud_mesh_item); + void + initParameters(CloudMeshItem* cloud_mesh_item) override; - virtual void - setupParameters(); + void + setupParameters() override; - virtual void - processImpl(CloudMeshItem* cloud_mesh_item); + void + processImpl(CloudMeshItem* cloud_mesh_item) override; private: CloudMesh::PointCloudPtr cloud_; @@ -81,5 +80,3 @@ namespace pcl } } - -#endif // PCL_MODELER_ICP_REGISTRATION_WORKER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/impl/scene_tree.hpp b/apps/modeler/include/pcl/apps/modeler/impl/scene_tree.hpp index bf6d68a8..49821584 100755 --- a/apps/modeler/include/pcl/apps/modeler/impl/scene_tree.hpp +++ b/apps/modeler/include/pcl/apps/modeler/impl/scene_tree.hpp @@ -49,12 +49,10 @@ namespace pcl { QList selected_items = selectedItems(); QList selected_t_items; - for (QList::iterator selected_items_it = selected_items.begin(); - selected_items_it != selected_items.end(); - ++ selected_items_it) + for (auto &selected_item : selected_items) { - T* t_item = dynamic_cast(*selected_items_it); - if(t_item != NULL) + T* t_item = dynamic_cast(selected_item); + if(t_item != nullptr) selected_t_items.push_back(t_item); } @@ -64,4 +62,4 @@ namespace pcl } -#endif // PCL_MODELER_SCENE_TREE_IMPL_H_ \ No newline at end of file +#endif // PCL_MODELER_SCENE_TREE_IMPL_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/main_window.h b/apps/modeler/include/pcl/apps/modeler/main_window.h index 4f061834..cfb5858e 100755 --- a/apps/modeler/include/pcl/apps/modeler/main_window.h +++ b/apps/modeler/include/pcl/apps/modeler/main_window.h @@ -34,14 +34,11 @@ * */ -#ifndef PCL_MODELER_MAIN_WINDOW_H_ -#define PCL_MODELER_MAIN_WINDOW_H_ - -#include -#include +#pragma once #include +#include namespace pcl { @@ -104,7 +101,7 @@ namespace pcl bool openProjectImpl(const QString& filename); static void - updateRecentActions(std::vector >& recent_actions, QStringList& recent_items); + updateRecentActions(std::vector>& recent_actions, QStringList& recent_items); // methods for view menu void @@ -130,8 +127,8 @@ namespace pcl friend class AbstractItem; MainWindow(); - MainWindow(const MainWindow &) : QMainWindow () {} // copy ctor hidden - MainWindow& operator=(const MainWindow &) { return (*this); } // assign op. hidden + MainWindow(const MainWindow &) = delete; + MainWindow& operator=(const MainWindow &) = delete; ~MainWindow(); Ui::MainWindow *ui_; // Designer form @@ -139,11 +136,9 @@ namespace pcl // shortcuts for recent point clouds/projects QStringList recent_files_; QStringList recent_projects_; - static const size_t MAX_RECENT_NUMBER = 8; - std::vector > recent_pointcloud_actions_; - std::vector > recent_project_actions_; + static const std::size_t MAX_RECENT_NUMBER = 8; + std::vector> recent_pointcloud_actions_; + std::vector> recent_project_actions_; }; } } - -#endif // PCL_MODELER_MAIN_WINDOW_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h b/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h index e594da2f..79f69ce0 100755 --- a/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/normal_estimation_worker.h @@ -34,8 +34,7 @@ * */ -#ifndef PCL_MODELER_NORMAL_ESTIMATION_WORKER_H_ -#define PCL_MODELER_NORMAL_ESTIMATION_WORKER_H_ +#pragma once #include @@ -48,21 +47,21 @@ namespace pcl class NormalEstimationWorker : public AbstractWorker { public: - NormalEstimationWorker(const QList& cloud_mesh_items, QWidget* parent = 0); - ~NormalEstimationWorker(void); + NormalEstimationWorker(const QList& cloud_mesh_items, QWidget* parent = nullptr); + ~NormalEstimationWorker(); protected: - virtual std::string - getName () const { return ("Normal Estimation"); } + std::string + getName () const override { return ("Normal Estimation"); } - virtual void - initParameters(CloudMeshItem* cloud_mesh_item); + void + initParameters(CloudMeshItem* cloud_mesh_item) override; - virtual void - setupParameters(); + void + setupParameters() override; - virtual void - processImpl(CloudMeshItem* cloud_mesh_item); + void + processImpl(CloudMeshItem* cloud_mesh_item) override; private: double x_min_, x_max_; @@ -75,4 +74,3 @@ namespace pcl } } -#endif // PCL_MODELER_NORMAL_ESTIMATION_WORKER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h b/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h index da0fe1db..780363ed 100755 --- a/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h +++ b/apps/modeler/include/pcl/apps/modeler/normals_actor_item.h @@ -33,8 +33,8 @@ * * */ -#ifndef PCL_MODELER_NORMALS_ACTOR_ITEM_H_ -#define PCL_MODELER_NORMALS_ACTOR_ITEM_H_ + +#pragma once #include #include @@ -49,31 +49,31 @@ namespace pcl { public: NormalsActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, + const CloudMesh::Ptr& cloud_mesh, const vtkSmartPointer& render_window); ~NormalsActorItem (); - virtual std::string - getItemName() const {return "Points Actor Item";} + std::string + getItemName() const override {return "Points Actor Item";} protected: void createNormalLines(); - virtual void - initImpl(); + void + initImpl() override; - virtual void - updateImpl(); + void + updateImpl() override; - virtual void - prepareContextMenu(QMenu* menu) const; + void + prepareContextMenu(QMenu* menu) const override; - virtual void - prepareProperties(ParameterDialog* parameter_dialog); + void + prepareProperties(ParameterDialog* parameter_dialog) override; - virtual void - setProperties(); + void + setProperties() override; private: double level_; @@ -81,5 +81,3 @@ namespace pcl }; } } - -#endif // PCL_MODELER_NORMALS_ACTOR_ITEM_H_ \ No newline at end of file diff --git a/apps/modeler/include/pcl/apps/modeler/parameter.h b/apps/modeler/include/pcl/apps/modeler/parameter.h index d45f1c1f..52aa3b47 100755 --- a/apps/modeler/include/pcl/apps/modeler/parameter.h +++ b/apps/modeler/include/pcl/apps/modeler/parameter.h @@ -33,15 +33,19 @@ * * */ -#ifndef PCL_MODELER_PARAMETER_H_ -#define PCL_MODELER_PARAMETER_H_ + +#pragma once #include #include #include -#include +#include +#include + +class QAbstractItemModel; +class QWidget; namespace pcl { @@ -52,7 +56,7 @@ namespace pcl public: Parameter(const std::string& name, const std::string& description, const boost::any& value): name_(name), description_(description), default_value_(value), current_value_(value){} - ~Parameter(void) {} + ~Parameter() {} const std::string& getName() const {return name_;} @@ -103,21 +107,21 @@ namespace pcl operator bool() const {return boost::any_cast(current_value_);} - virtual std::string - valueTip(); + std::string + valueTip() override; - virtual QWidget* - createEditor(QWidget *parent); + QWidget* + createEditor(QWidget *parent) override; - virtual void - setEditorData(QWidget *editor); + void + setEditorData(QWidget *editor) override; - virtual std::pair - toModelData(); + std::pair + toModelData() override; protected: - virtual void - getEditorData(QWidget *editor); + void + getEditorData(QWidget *editor) override; }; class IntParameter : public Parameter @@ -129,17 +133,17 @@ namespace pcl operator int() const {return boost::any_cast(current_value_);} - virtual std::string - valueTip(); + std::string + valueTip() override; - virtual QWidget* - createEditor(QWidget *parent); + QWidget* + createEditor(QWidget *parent) override; - virtual void - setEditorData(QWidget *editor); + void + setEditorData(QWidget *editor) override; - virtual std::pair - toModelData(); + std::pair + toModelData() override; void setLow(int low) @@ -160,8 +164,8 @@ namespace pcl } protected: - virtual void - getEditorData(QWidget *editor); + void + getEditorData(QWidget *editor) override; int low_; int high_; @@ -178,21 +182,21 @@ namespace pcl operator T() const {return boost::any_cast(current_value_);} - virtual std::string - valueTip(); + std::string + valueTip() override; - virtual QWidget* - createEditor(QWidget *parent); + QWidget* + createEditor(QWidget *parent) override; - virtual void - setEditorData(QWidget *editor); + void + setEditorData(QWidget *editor) override; - virtual std::pair - toModelData(); + std::pair + toModelData() override; protected: - virtual void - getEditorData(QWidget *editor); + void + getEditorData(QWidget *editor) override; const std::map candidates_; }; @@ -206,17 +210,17 @@ namespace pcl operator double() const {return boost::any_cast(current_value_);} - virtual std::string - valueTip(); + std::string + valueTip() override; - virtual QWidget* - createEditor(QWidget *parent); + QWidget* + createEditor(QWidget *parent) override; - virtual void - setEditorData(QWidget *editor); + void + setEditorData(QWidget *editor) override; - virtual std::pair - toModelData(); + std::pair + toModelData() override; void setLow(double low) @@ -237,8 +241,8 @@ namespace pcl } protected: - virtual void - getEditorData(QWidget *editor); + void + getEditorData(QWidget *editor) override; double low_; double high_; @@ -248,30 +252,28 @@ namespace pcl class ColorParameter : public Parameter { public: - ColorParameter(const std::string& name, const std::string& description, QColor value): + ColorParameter(const std::string& name, const std::string& description, const QColor& value): Parameter(name, description, value){} ~ColorParameter(){} operator QColor() const {return boost::any_cast(current_value_);} - virtual std::string - valueTip(); + std::string + valueTip() override; - virtual QWidget* - createEditor(QWidget *parent); + QWidget* + createEditor(QWidget *parent) override; - virtual void - setEditorData(QWidget *editor); + void + setEditorData(QWidget *editor) override; - virtual std::pair - toModelData(); + std::pair + toModelData() override; protected: - virtual void - getEditorData(QWidget *editor); + void + getEditorData(QWidget *editor) override; }; } } - -#endif // PCL_MODELER_PARAMETER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h b/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h index 4e1247e4..4fa57972 100755 --- a/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h +++ b/apps/modeler/include/pcl/apps/modeler/parameter_dialog.h @@ -33,10 +33,12 @@ * * */ -#ifndef PCL_MODELER_PARAMETER_DIALOG_H_ -#define PCL_MODELER_PARAMETER_DIALOG_H_ -#include +#pragma once + +#include +#include +#include namespace pcl { @@ -47,12 +49,12 @@ namespace pcl class ParameterModel: public QStandardItemModel { public: - ParameterModel(QObject * parent = 0) : QStandardItemModel(parent){} - ParameterModel(int rows, int columns, QObject * parent = 0) : QStandardItemModel(rows, columns, parent){} + ParameterModel(QObject * parent = nullptr) : QStandardItemModel(parent){} + ParameterModel(int rows, int columns, QObject * parent = nullptr) : QStandardItemModel(rows, columns, parent){} ~ParameterModel() {} Qt::ItemFlags - flags ( const QModelIndex & index ) const + flags ( const QModelIndex & index ) const override { return (index.column() == 0)?(Qt::ItemIsEnabled | Qt::ItemIsSelectable):QStandardItemModel::flags(index); } @@ -62,14 +64,14 @@ namespace pcl { Q_OBJECT public: - ParameterDialog(const std::string& title, QWidget* parent=0); - ~ParameterDialog(void){} + ParameterDialog(const std::string& title, QWidget* parent=nullptr); + ~ParameterDialog(){} void addParameter(Parameter* parameter); - virtual int - exec(); + int + exec() override; protected: std::map name_parameter_map_; @@ -84,23 +86,23 @@ namespace pcl { Q_OBJECT public: - ParameterDelegate(std::map& parameterMap, QObject *parent = 0); + ParameterDelegate(std::map& parameterMap, QObject *parent = nullptr); QWidget * - createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; + createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; void - setEditorData(QWidget *editor, const QModelIndex &index) const; + setEditorData(QWidget *editor, const QModelIndex &index) const override; void - setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; + setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; void - updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; + updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override; protected: void - initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const; + initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override; private: Parameter* @@ -111,5 +113,3 @@ namespace pcl } } - -#endif // PCL_MODELER_PARAMETER_DIALOG_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/points_actor_item.h b/apps/modeler/include/pcl/apps/modeler/points_actor_item.h index f6ed4a2e..8ffde6f7 100755 --- a/apps/modeler/include/pcl/apps/modeler/points_actor_item.h +++ b/apps/modeler/include/pcl/apps/modeler/points_actor_item.h @@ -33,8 +33,8 @@ * * */ -#ifndef PCL_MODELER_POINTS_ACTOR_ITEM_H_ -#define PCL_MODELER_POINTS_ACTOR_ITEM_H_ + +#pragma once #include #include @@ -49,33 +49,31 @@ namespace pcl { public: PointsActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, + const CloudMesh::Ptr& cloud_mesh, const vtkSmartPointer& render_window); ~PointsActorItem (); - virtual std::string - getItemName() const {return "Points Actor Item";} + std::string + getItemName() const override {return "Points Actor Item";} protected: - virtual void - initImpl(); + void + initImpl() override; - virtual void - updateImpl(); + void + updateImpl() override; - virtual void - prepareContextMenu(QMenu* menu) const; + void + prepareContextMenu(QMenu* menu) const override; - virtual void - prepareProperties(ParameterDialog* parameter_dialog); + void + prepareProperties(ParameterDialog* parameter_dialog) override; - virtual void - setProperties(); + void + setProperties() override; private: }; } } - -#endif // PCL_MODELER_POINTS_ACTOR_ITEM_H_ \ No newline at end of file diff --git a/apps/modeler/include/pcl/apps/modeler/poisson_worker.h b/apps/modeler/include/pcl/apps/modeler/poisson_worker.h index be399091..61ee8996 100755 --- a/apps/modeler/include/pcl/apps/modeler/poisson_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/poisson_worker.h @@ -34,8 +34,7 @@ * */ -#ifndef PCL_MODELER_POISSON_WORKER_H_ -#define PCL_MODELER_POISSON_WORKER_H_ +#pragma once #include @@ -49,21 +48,21 @@ namespace pcl class PoissonReconstructionWorker : public AbstractWorker { public: - PoissonReconstructionWorker(const QList& cloud_mesh_items, QWidget* parent=0); - ~PoissonReconstructionWorker(void); + PoissonReconstructionWorker(const QList& cloud_mesh_items, QWidget* parent=nullptr); + ~PoissonReconstructionWorker(); protected: - virtual std::string - getName () const {return ("Poisson Reconstruction");} + std::string + getName () const override {return ("Poisson Reconstruction");} - virtual void - initParameters (CloudMeshItem*) {} + void + initParameters (CloudMeshItem*) override {} - virtual void - setupParameters(); + void + setupParameters() override; - virtual void - processImpl(CloudMeshItem* cloud_mesh_item); + void + processImpl(CloudMeshItem* cloud_mesh_item) override; private: IntParameter* depth_; @@ -76,5 +75,3 @@ namespace pcl } } - -#endif // PCL_MODELER_POISSON_WORKER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/qt.h b/apps/modeler/include/pcl/apps/modeler/qt.h deleted file mode 100644 index 6ba50022..00000000 --- a/apps/modeler/include/pcl/apps/modeler/qt.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef PCL_MODELER_QT_H_ -#define PCL_MODELER_QT_H_ - -#ifdef __GNUC__ -#pragma GCC system_header -#endif - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // PCL_MODELER_QT_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/render_window.h b/apps/modeler/include/pcl/apps/modeler/render_window.h index 8b305813..763c3ca8 100755 --- a/apps/modeler/include/pcl/apps/modeler/render_window.h +++ b/apps/modeler/include/pcl/apps/modeler/render_window.h @@ -34,12 +34,12 @@ * */ -#ifndef PCL_MODELER_RENDER_WINDOW_H_ -#define PCL_MODELER_RENDER_WINDOW_H_ +#pragma once -#include #include +#include + class vtkCubeAxesActor; namespace pcl @@ -51,11 +51,11 @@ namespace pcl class RenderWindow : public QVTKWidget { public: - RenderWindow(RenderWindowItem* render_window_item, QWidget *parent = 0, Qt::WindowFlags flags = 0); + RenderWindow(RenderWindowItem* render_window_item, QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr); ~RenderWindow(); - virtual QSize - sizeHint() const {return QSize(512, 512);} + QSize + sizeHint() const override {return {512, 512};} void setActive(bool flag); @@ -83,7 +83,7 @@ namespace pcl protected: void - focusInEvent(QFocusEvent * event); + focusInEvent(QFocusEvent * event) override; private: void @@ -94,5 +94,3 @@ namespace pcl }; } } - -#endif // PCL_MODELER_RENDER_WINDOW_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/render_window_item.h b/apps/modeler/include/pcl/apps/modeler/render_window_item.h index a94374b6..7709f32e 100755 --- a/apps/modeler/include/pcl/apps/modeler/render_window_item.h +++ b/apps/modeler/include/pcl/apps/modeler/render_window_item.h @@ -34,10 +34,10 @@ * */ -#ifndef PCL_MODELER_RENDER_WINDOW_ITEM_H_ -#define PCL_MODELER_RENDER_WINDOW_ITEM_H_ +#pragma once + +#include -#include #include #include @@ -74,18 +74,18 @@ namespace pcl CloudMeshItem* addPointCloud(CloudMesh::PointCloudPtr cloud); - virtual std::string - getItemName() const {return "Render Window Item";} + std::string + getItemName() const override {return "Render Window Item";} protected: - virtual void - prepareContextMenu(QMenu* menu) const; + void + prepareContextMenu(QMenu* menu) const override; - virtual void - prepareProperties(ParameterDialog* parameter_dialog); + void + prepareProperties(ParameterDialog* parameter_dialog) override; - virtual void - setProperties(); + void + setProperties() override; private: RenderWindow* render_window_; @@ -94,5 +94,3 @@ namespace pcl }; } } - -#endif // PCL_MODELER_RENDER_WINDOW_ITEM_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/scene_tree.h b/apps/modeler/include/pcl/apps/modeler/scene_tree.h index 45ab0468..82e4c99e 100755 --- a/apps/modeler/include/pcl/apps/modeler/scene_tree.h +++ b/apps/modeler/include/pcl/apps/modeler/scene_tree.h @@ -34,10 +34,9 @@ * */ -#ifndef PCL_MODELER_SCENE_TREE_H_ -#define PCL_MODELER_SCENE_TREE_H_ +#pragma once -#include +#include namespace pcl { @@ -51,11 +50,11 @@ namespace pcl Q_OBJECT public: - SceneTree(QWidget * parent = 0); + SceneTree(QWidget * parent = nullptr); ~SceneTree(); - virtual QSize - sizeHint() const; + QSize + sizeHint() const override; bool openPointCloud(const QString& filename); @@ -107,11 +106,11 @@ namespace pcl itemInsertedOrRemoved(); protected: - virtual void - dropEvent(QDropEvent * event); + void + dropEvent(QDropEvent * event) override; - virtual bool - dropMimeData(QTreeWidgetItem * parent, int index, const QMimeData * data, Qt::DropAction action); + bool + dropMimeData(QTreeWidgetItem * parent, int index, const QMimeData * data, Qt::DropAction action) override; private Q_SLOTS: void @@ -133,12 +132,10 @@ namespace pcl static void closePointCloud(const QList& items); - virtual void - contextMenuEvent(QContextMenuEvent *event); + void + contextMenuEvent(QContextMenuEvent *event) override; }; } } #include - -#endif // PCL_MODELER_SCENE_TREE_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h b/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h index 7992a896..b7176161 100755 --- a/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/statistical_outlier_removal_worker.h @@ -34,8 +34,7 @@ * */ -#ifndef PCL_MODELER_STATISTICAL_OUTLIER_REMOVAL_WORKER_H_ -#define PCL_MODELER_STATISTICAL_OUTLIER_REMOVAL_WORKER_H_ +#pragma once #include @@ -49,21 +48,21 @@ namespace pcl class StatisticalOutlierRemovalWorker : public AbstractWorker { public: - StatisticalOutlierRemovalWorker(const QList& cloud_mesh_items, QWidget* parent=0); - ~StatisticalOutlierRemovalWorker(void); + StatisticalOutlierRemovalWorker(const QList& cloud_mesh_items, QWidget* parent=nullptr); + ~StatisticalOutlierRemovalWorker(); protected: - virtual std::string - getName () const {return ("Statistical Outlier Removal");} + std::string + getName () const override {return ("Statistical Outlier Removal");} - virtual void - initParameters(CloudMeshItem* cloud_mesh_item); + void + initParameters(CloudMeshItem* cloud_mesh_item) override; - virtual void - setupParameters(); + void + setupParameters() override; - virtual void - processImpl(CloudMeshItem* cloud_mesh_item); + void + processImpl(CloudMeshItem* cloud_mesh_item) override; private: IntParameter* mean_k_; @@ -73,5 +72,3 @@ namespace pcl } } - -#endif // PCL_MODELER_STATISTICAL_OUTLIER_REMOVAL_WORKER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/surface_actor_item.h b/apps/modeler/include/pcl/apps/modeler/surface_actor_item.h index 43a1a446..e942641c 100755 --- a/apps/modeler/include/pcl/apps/modeler/surface_actor_item.h +++ b/apps/modeler/include/pcl/apps/modeler/surface_actor_item.h @@ -33,8 +33,8 @@ * * */ -#ifndef PCL_MODELER_SURFACE_ACTOR_ITEM_H_ -#define PCL_MODELER_SURFACE_ACTOR_ITEM_H_ + +#pragma once #include #include @@ -48,41 +48,39 @@ namespace pcl class SurfaceActorItem : public ChannelActorItem { public: - typedef pcl::visualization::PointCloudGeometryHandler GeometryHandler; - typedef GeometryHandler::Ptr GeometryHandlerPtr; - typedef GeometryHandler::ConstPtr GeometryHandlerConstPtr; + using GeometryHandler = pcl::visualization::PointCloudGeometryHandler; + using GeometryHandlerPtr = GeometryHandler::Ptr; + using GeometryHandlerConstPtr = GeometryHandler::ConstPtr; - typedef pcl::visualization::PointCloudColorHandler ColorHandler; - typedef ColorHandler::Ptr ColorHandlerPtr; - typedef ColorHandler::ConstPtr ColorHandlerConstPtr; + using ColorHandler = pcl::visualization::PointCloudColorHandler; + using ColorHandlerPtr = ColorHandler::Ptr; + using ColorHandlerConstPtr = ColorHandler::ConstPtr; SurfaceActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, + const CloudMesh::Ptr& cloud_mesh, const vtkSmartPointer& render_window); ~SurfaceActorItem (); - virtual std::string - getItemName() const {return "Points Actor Item";} + std::string + getItemName() const override {return "Points Actor Item";} protected: - virtual void - initImpl(); + void + initImpl() override; - virtual void - updateImpl(); + void + updateImpl() override; - virtual void - prepareContextMenu(QMenu* menu) const; + void + prepareContextMenu(QMenu* menu) const override; - virtual void - prepareProperties(ParameterDialog* parameter_dialog); + void + prepareProperties(ParameterDialog* parameter_dialog) override; - virtual void - setProperties(); + void + setProperties() override; private: }; } } - -#endif // PCL_MODELER_SURFACE_ACTOR_ITEM_H_ \ No newline at end of file diff --git a/apps/modeler/include/pcl/apps/modeler/thread_controller.h b/apps/modeler/include/pcl/apps/modeler/thread_controller.h index f6a56be1..5326bcb2 100755 --- a/apps/modeler/include/pcl/apps/modeler/thread_controller.h +++ b/apps/modeler/include/pcl/apps/modeler/thread_controller.h @@ -34,10 +34,9 @@ * */ -#ifndef PCL_MODELER_THREAD_CONTROLLER_H_ -#define PCL_MODELER_THREAD_CONTROLLER_H_ +#pragma once -#include +#include namespace pcl { @@ -52,7 +51,7 @@ namespace pcl public: ThreadController(); - ~ThreadController(void); + ~ThreadController(); bool runWorker(AbstractWorker* worker); @@ -68,5 +67,3 @@ namespace pcl } } - -#endif // PCL_MODELER_THREAD_CONTROLLER_H_ diff --git a/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h b/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h index c68133d7..f2ded2c2 100755 --- a/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h +++ b/apps/modeler/include/pcl/apps/modeler/voxel_grid_downsample_worker.h @@ -34,8 +34,7 @@ * */ -#ifndef PCL_MODELER_DOWNSAMPLE_WORKER_H_ -#define PCL_MODELER_DOWNSAMPLE_WORKER_H_ +#pragma once #include @@ -48,21 +47,21 @@ namespace pcl class VoxelGridDownampleWorker : public AbstractWorker { public: - VoxelGridDownampleWorker(const QList& cloud_mesh_items, QWidget* parent=0); - ~VoxelGridDownampleWorker(void); + VoxelGridDownampleWorker(const QList& cloud_mesh_items, QWidget* parent=nullptr); + ~VoxelGridDownampleWorker(); protected: - virtual std::string - getName () const {return ("Down Sample");} + std::string + getName () const override {return ("Down Sample");} - virtual void - initParameters(CloudMeshItem* cloud_mesh_item); + void + initParameters(CloudMeshItem* cloud_mesh_item) override; - virtual void - setupParameters(); + void + setupParameters() override; - virtual void - processImpl(CloudMeshItem* cloud_mesh_item); + void + processImpl(CloudMeshItem* cloud_mesh_item) override; private: double x_min_, x_max_; @@ -77,5 +76,3 @@ namespace pcl } } - -#endif // PCL_MODELER_DOWNSAMPLE_WORKER_H_ diff --git a/apps/modeler/src/abstract_item.cpp b/apps/modeler/src/abstract_item.cpp index f3816c6b..ef004f98 100755 --- a/apps/modeler/src/abstract_item.cpp +++ b/apps/modeler/src/abstract_item.cpp @@ -36,19 +36,18 @@ #include -#include #include #include ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::AbstractItem::AbstractItem(void) +pcl::modeler::AbstractItem::AbstractItem() { } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::AbstractItem::~AbstractItem(void) +pcl::modeler::AbstractItem::~AbstractItem() { } @@ -82,4 +81,4 @@ pcl::modeler::AbstractItem::showPropertyEditor() setProperties(); parameter_dialog->deleteLater(); -} \ No newline at end of file +} diff --git a/apps/modeler/src/abstract_worker.cpp b/apps/modeler/src/abstract_worker.cpp index 6873ddd1..7ba717af 100755 --- a/apps/modeler/src/abstract_worker.cpp +++ b/apps/modeler/src/abstract_worker.cpp @@ -36,7 +36,6 @@ #include -#include #include #include @@ -49,7 +48,7 @@ pcl::modeler::AbstractWorker::AbstractWorker(const QList& cloud_ } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::AbstractWorker::~AbstractWorker(void) +pcl::modeler::AbstractWorker::~AbstractWorker() { parameter_dialog_->deleteLater(); } @@ -58,10 +57,8 @@ pcl::modeler::AbstractWorker::~AbstractWorker(void) int pcl::modeler::AbstractWorker::exec() { - for (QList::iterator cloud_mesh_items_it = cloud_mesh_items_.begin(); - cloud_mesh_items_it != cloud_mesh_items_.end(); - ++ cloud_mesh_items_it) - initParameters(*cloud_mesh_items_it); + for (auto &cloud_mesh_item : cloud_mesh_items_) + initParameters(cloud_mesh_item); setupParameters(); @@ -72,11 +69,9 @@ pcl::modeler::AbstractWorker::exec() void pcl::modeler::AbstractWorker::process() { - for (QList::iterator cloud_mesh_items_it = cloud_mesh_items_.begin(); - cloud_mesh_items_it != cloud_mesh_items_.end(); - ++ cloud_mesh_items_it) + for (auto &cloud_mesh_item : cloud_mesh_items_) { - processImpl(*cloud_mesh_items_it); + processImpl(cloud_mesh_item); } emit finished(); diff --git a/apps/modeler/src/channel_actor_item.cpp b/apps/modeler/src/channel_actor_item.cpp index ebd42141..2a256847 100755 --- a/apps/modeler/src/channel_actor_item.cpp +++ b/apps/modeler/src/channel_actor_item.cpp @@ -47,12 +47,11 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::ChannelActorItem::ChannelActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, + const CloudMesh::Ptr& cloud_mesh, const vtkSmartPointer& render_window, const vtkSmartPointer& actor, const std::string& channel_name) :QTreeWidgetItem(parent), - AbstractItem(), cloud_mesh_(cloud_mesh), poly_data_(vtkSmartPointer::New()), render_window_(render_window), diff --git a/apps/modeler/src/cloud_mesh.cpp b/apps/modeler/src/cloud_mesh.cpp index 9d65c73c..cd2d2b2f 100755 --- a/apps/modeler/src/cloud_mesh.cpp +++ b/apps/modeler/src/cloud_mesh.cpp @@ -56,7 +56,7 @@ pcl::modeler::CloudMesh::CloudMesh() ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::CloudMesh::CloudMesh(PointCloudPtr cloud) - :cloud_(cloud), + :cloud_(std::move(cloud)), vtk_points_(vtkSmartPointer::New()), vtk_polygons_(vtkSmartPointer::New()) { @@ -115,22 +115,20 @@ pcl::modeler::CloudMesh::save(const std::vector& cloud_meshes, return (cloud_meshes[0]->save(filename)); CloudMesh cloud_mesh; - for (size_t i = 0, i_end = cloud_meshes.size(); i < i_end; ++ i) + for (const auto &mesh : cloud_meshes) { if (filename.rfind(".obj") == (filename.length()-4)) { - size_t delta = cloud_mesh.cloud_->size(); - const std::vector& polygons = cloud_meshes[i]->polygons_; - for (size_t j = 0, j_end = polygons.size(); j < j_end; ++ j) + std::size_t delta = cloud_mesh.cloud_->size(); + for (auto polygon : mesh->polygons_) { - pcl::Vertices polygon = polygons[j]; - for (size_t k = 0, k_end = polygon.vertices.size(); k < k_end; ++ k) - polygon.vertices[k] += static_cast (delta); + for (unsigned int &vertice : polygon.vertices) + vertice += static_cast (delta); cloud_mesh.polygons_.push_back(polygon); } } - *cloud_mesh.cloud_ += *(cloud_meshes[i]->cloud_); + *cloud_mesh.cloud_ += *(mesh->cloud_); } return (cloud_mesh.save(filename)); @@ -143,19 +141,19 @@ pcl::modeler::CloudMesh::getColorScalarsFromField(vtkSmartPointer if (field == "rgb" || field == "rgba") { pcl::visualization::PointCloudColorHandlerRGBField color_handler(cloud_); - color_handler.getColor(scalars); + scalars = color_handler.getColor(); return; } if (field == "random") { pcl::visualization::PointCloudColorHandlerRandom color_handler(cloud_); - color_handler.getColor(scalars); + scalars = color_handler.getColor(); return; } pcl::visualization::PointCloudColorHandlerGenericField color_handler(cloud_, field); - color_handler.getColor(scalars); + scalars = color_handler.getColor(); return; } @@ -164,7 +162,7 @@ pcl::modeler::CloudMesh::getColorScalarsFromField(vtkSmartPointer void pcl::modeler::CloudMesh::updateVtkPoints() { - if (vtk_points_->GetData() == NULL) + if (vtk_points_->GetData() == nullptr) vtk_points_->SetData(vtkSmartPointer::New ()); vtkFloatArray* data = dynamic_cast(vtk_points_->GetData()); @@ -212,12 +210,11 @@ pcl::modeler::CloudMesh::updateVtkPolygons() if (cloud_->is_dense) { - for (size_t i = 0, i_end = polygons_.size (); i < i_end; ++i) + for (const auto &polygon : polygons_) { - size_t n_points = polygons_[i].vertices.size (); - vtk_polygons_->InsertNextCell (static_cast (n_points)); - for (size_t j = 0; j < n_points; j++) - vtk_polygons_->InsertCellPoint (polygons_[i].vertices[j]); + vtk_polygons_->InsertNextCell (polygon.vertices.size()); + for (const unsigned int &vertex : polygon.vertices) + vtk_polygons_->InsertCellPoint (vertex); } } else @@ -225,12 +222,11 @@ pcl::modeler::CloudMesh::updateVtkPolygons() pcl::IndicesPtr indices(new std::vector()); pcl::removeNaNFromPointCloud(*cloud_, *indices); - for (size_t i = 0, i_end = polygons_.size(); i < i_end; ++i) + for (const auto &polygon : polygons_) { - size_t n_points = polygons_[i].vertices.size (); - vtk_polygons_->InsertNextCell (static_cast (n_points)); - for (size_t j = 0; j < n_points; j++) - vtk_polygons_->InsertCellPoint ((*indices)[polygons_[i].vertices[j]]); + vtk_polygons_->InsertNextCell (polygon.vertices.size()); + for (const unsigned int &vertex : polygon.vertices) + vtk_polygons_->InsertCellPoint ((*indices)[vertex]); } } diff --git a/apps/modeler/src/cloud_mesh_item.cpp b/apps/modeler/src/cloud_mesh_item.cpp index 3c320403..14fb6b4f 100755 --- a/apps/modeler/src/cloud_mesh_item.cpp +++ b/apps/modeler/src/cloud_mesh_item.cpp @@ -51,9 +51,8 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::CloudMeshItem::CloudMeshItem (QTreeWidgetItem* parent, const std::string& filename) :QTreeWidgetItem(parent), - AbstractItem(), filename_(filename), - cloud_mesh_(boost::shared_ptr(new CloudMesh())), + cloud_mesh_(new CloudMesh), translation_x_(new DoubleParameter("Translation X", "Translation X", 0.0, -1.0, 1.0)), translation_y_(new DoubleParameter("Translation Y", "Translation Y", 0.0, -1.0, 1.0)), translation_z_(new DoubleParameter("Translation Z", "Translation Z", 0.0, -1.0, 1.0)), @@ -68,9 +67,8 @@ pcl::modeler::CloudMeshItem::CloudMeshItem (QTreeWidgetItem* parent, const std:: ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::CloudMeshItem::CloudMeshItem (QTreeWidgetItem* parent, CloudMesh::PointCloudPtr cloud) :QTreeWidgetItem(parent), - AbstractItem(), filename_("unnamed point cloud"), - cloud_mesh_(boost::shared_ptr(new CloudMesh(cloud))), + cloud_mesh_(new CloudMesh (std::move(cloud))), translation_x_(new DoubleParameter("Translation X", "Translation X", 0.0, -1.0, 1.0)), translation_y_(new DoubleParameter("Translation Y", "Translation Y", 0.0, -1.0, 1.0)), translation_z_(new DoubleParameter("Translation Z", "Translation Z", 0.0, -1.0, 1.0)), @@ -89,7 +87,6 @@ pcl::modeler::CloudMeshItem::CloudMeshItem (QTreeWidgetItem* parent, CloudMesh:: ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::CloudMeshItem::CloudMeshItem(QTreeWidgetItem* parent, const CloudMeshItem& cloud_mesh_item) :QTreeWidgetItem(parent), - AbstractItem(), filename_(cloud_mesh_item.filename_), cloud_mesh_(cloud_mesh_item.cloud_mesh_), translation_x_(new DoubleParameter("Translation X", "Translation X", 0.0, -1.0, 1.0)), @@ -120,11 +117,9 @@ pcl::modeler::CloudMeshItem::savePointCloud(const QList& items, return (items.first()->getCloudMesh()->save(filename.toStdString())); std::vector cloud_meshes; - for (QList::const_iterator items_it = items.begin(); - items_it != items.end(); - ++ items_it) + for (const auto &item : items) { - cloud_meshes.push_back((*items_it)->getCloudMesh().get()); + cloud_meshes.push_back(item->getCloudMesh().get()); } return (CloudMesh::save(cloud_meshes, filename.toStdString())); @@ -253,4 +248,4 @@ pcl::modeler::CloudMeshItem::updateRenderWindow() render_window_item->getRenderWindow()->resetCamera(); return; -} \ No newline at end of file +} diff --git a/apps/modeler/src/cloud_mesh_item_updater.cpp b/apps/modeler/src/cloud_mesh_item_updater.cpp index 8716cab9..3bbe5c05 100755 --- a/apps/modeler/src/cloud_mesh_item_updater.cpp +++ b/apps/modeler/src/cloud_mesh_item_updater.cpp @@ -57,4 +57,4 @@ pcl::modeler::CloudMeshItemUpdater::updateCloudMeshItem() cloud_mesh_item_->updateChannels(); deleteLater(); -} \ No newline at end of file +} diff --git a/apps/modeler/src/icp_registration_worker.cpp b/apps/modeler/src/icp_registration_worker.cpp index f3e8ad29..a6e31886 100755 --- a/apps/modeler/src/icp_registration_worker.cpp +++ b/apps/modeler/src/icp_registration_worker.cpp @@ -45,20 +45,20 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::ICPRegistrationWorker::ICPRegistrationWorker(CloudMesh::PointCloudPtr cloud, const QList& cloud_mesh_items, QWidget* parent) : AbstractWorker(cloud_mesh_items, parent), - cloud_(cloud), + cloud_(std::move(cloud)), x_min_(std::numeric_limits::max()), x_max_(std::numeric_limits::min()), y_min_(std::numeric_limits::max()), y_max_(std::numeric_limits::min()), z_min_(std::numeric_limits::max()), z_max_(std::numeric_limits::min()), - max_correspondence_distance_(NULL), - max_iterations_(NULL), - transformation_epsilon_(NULL), - euclidean_fitness_epsilon_(NULL) + max_correspondence_distance_(nullptr), + max_iterations_(nullptr), + transformation_epsilon_(nullptr), + euclidean_fitness_epsilon_(nullptr) { } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::ICPRegistrationWorker::~ICPRegistrationWorker(void) +pcl::modeler::ICPRegistrationWorker::~ICPRegistrationWorker() { } diff --git a/apps/modeler/src/main.cpp b/apps/modeler/src/main.cpp index 59a9a49c..db2aa82d 100755 --- a/apps/modeler/src/main.cpp +++ b/apps/modeler/src/main.cpp @@ -34,7 +34,6 @@ * */ -#include #include extern int qInitResources_resources(); @@ -47,5 +46,5 @@ int main( int argc, char** argv ) pcl::modeler::MainWindow::getInstance().show(); - return app.exec(); + return QApplication::exec(); } diff --git a/apps/modeler/src/main_window.cpp b/apps/modeler/src/main_window.cpp index f65cc677..3b4145bd 100755 --- a/apps/modeler/src/main_window.cpp +++ b/apps/modeler/src/main_window.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -201,9 +202,9 @@ pcl::modeler::MainWindow::slotOpenRecentProject() void pcl::modeler::MainWindow::createRecentPointCloudActions() { - for (size_t i = 0; i < MAX_RECENT_NUMBER; ++ i) + for (std::size_t i = 0; i < MAX_RECENT_NUMBER; ++ i) { - recent_pointcloud_actions_.push_back(boost::shared_ptr(new QAction(this))); + recent_pointcloud_actions_.push_back(std::shared_ptr(new QAction(this))); ui_->menuRecentPointClouds->addAction(recent_pointcloud_actions_[i].get()); recent_pointcloud_actions_[i]->setVisible(false); connect(recent_pointcloud_actions_[i].get(), SIGNAL(triggered()), this, SLOT(slotOpenRecentPointCloud())); @@ -225,9 +226,9 @@ pcl::modeler::MainWindow::updateRecentPointCloudActions() void pcl::modeler::MainWindow::createRecentProjectActions() { - for (size_t i = 0; i < MAX_RECENT_NUMBER; ++ i) + for (std::size_t i = 0; i < MAX_RECENT_NUMBER; ++ i) { - recent_project_actions_.push_back(boost::shared_ptr(new QAction(this))); + recent_project_actions_.push_back(std::shared_ptr(new QAction(this))); ui_->menuRecentPointClouds->addAction(recent_project_actions_[i].get()); recent_project_actions_[i]->setVisible(false); connect(recent_project_actions_[i].get(), SIGNAL(triggered()), this, SLOT(slotOpenRecentProject())); @@ -254,7 +255,7 @@ pcl::modeler::MainWindow::openProjectImpl (const QString&) ////////////////////////////////////////////////////////////////////////////////////////////// void -pcl::modeler::MainWindow::updateRecentActions (std::vector >& recent_actions, QStringList& recent_items) +pcl::modeler::MainWindow::updateRecentActions (std::vector>& recent_actions, QStringList& recent_items) { QMutableStringListIterator recent_items_it (recent_items); while (recent_items_it.hasNext ()) @@ -273,7 +274,7 @@ pcl::modeler::MainWindow::updateRecentActions (std::vectorsetVisible (true); } - for (size_t i = recent_number, i_end = recent_actions.size (); i < i_end; ++ i) + for (std::size_t i = recent_number, i_end = recent_actions.size (); i < i_end; ++ i) recent_actions[i]->setVisible (false); while (recent_items.size () > recent_number) @@ -336,4 +337,4 @@ void pcl::modeler::MainWindow::slotOnWorkerFinished() { statusBar()->showMessage(QString("Working thread finished...")); -} \ No newline at end of file +} diff --git a/apps/modeler/src/normal_estimation_worker.cpp b/apps/modeler/src/normal_estimation_worker.cpp index 54e16929..7165b5b0 100755 --- a/apps/modeler/src/normal_estimation_worker.cpp +++ b/apps/modeler/src/normal_estimation_worker.cpp @@ -50,13 +50,13 @@ pcl::modeler::NormalEstimationWorker::NormalEstimationWorker(const QList::max()), x_max_(std::numeric_limits::min()), y_min_(std::numeric_limits::max()), y_max_(std::numeric_limits::min()), z_min_(std::numeric_limits::max()), z_max_(std::numeric_limits::min()), - search_radius_(NULL) + search_radius_(nullptr) { } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::NormalEstimationWorker::~NormalEstimationWorker(void) +pcl::modeler::NormalEstimationWorker::~NormalEstimationWorker() { delete search_radius_; } @@ -125,9 +125,9 @@ pcl::modeler::NormalEstimationWorker::processImpl(CloudMeshItem* cloud_mesh_item pcl::PointCloud normals; normal_estimator.compute(normals); - for (size_t i = 0, i_end = indices->size(); i < i_end; ++ i) + for (std::size_t i = 0, i_end = indices->size(); i < i_end; ++ i) { - size_t dest = (*indices)[i]; + std::size_t dest = (*indices)[i]; cloud->points[dest].normal_x = normals.points[i].normal_x; cloud->points[dest].normal_y = normals.points[i].normal_y; cloud->points[dest].normal_z = normals.points[i].normal_z; diff --git a/apps/modeler/src/normals_actor_item.cpp b/apps/modeler/src/normals_actor_item.cpp index fc8bd541..bc223918 100755 --- a/apps/modeler/src/normals_actor_item.cpp +++ b/apps/modeler/src/normals_actor_item.cpp @@ -47,8 +47,8 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::NormalsActorItem::NormalsActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, - const vtkSmartPointer& render_window) + const CloudMesh::Ptr& cloud_mesh, + const vtkSmartPointer& render_window) :ChannelActorItem(parent, cloud_mesh, render_window, vtkSmartPointer::New(), "Normals"), level_(10), scale_(0.1) { @@ -72,7 +72,7 @@ pcl::modeler::NormalsActorItem::createNormalLines() if (cloud->empty()) return; - if (points->GetData() == NULL) + if (points->GetData() == nullptr) points->SetData(vtkSmartPointer::New ()); vtkFloatArray* data = dynamic_cast(points->GetData()); @@ -137,11 +137,7 @@ pcl::modeler::NormalsActorItem::initImpl() createNormalLines(); vtkSmartPointer mapper = vtkSmartPointer::New(); -#if VTK_MAJOR_VERSION < 6 - mapper->SetInput(poly_data_); -#else mapper->SetInputData (poly_data_); -#endif vtkSmartPointer scalars; cloud_mesh_->getColorScalarsFromField(scalars, color_scheme_); diff --git a/apps/modeler/src/parameter.cpp b/apps/modeler/src/parameter.cpp index 4eb3616f..8d639d5f 100755 --- a/apps/modeler/src/parameter.cpp +++ b/apps/modeler/src/parameter.cpp @@ -40,6 +40,11 @@ #include #include +#include +#include +#include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// void pcl::modeler::Parameter::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) @@ -240,4 +245,4 @@ pcl::modeler::ColorParameter::toModelData() model_data.first = QBrush(QColor(*this)); model_data.second = Qt::BackgroundRole; return (model_data); -} \ No newline at end of file +} diff --git a/apps/modeler/src/parameter_dialog.cpp b/apps/modeler/src/parameter_dialog.cpp index 0dce6d7a..fcdca246 100755 --- a/apps/modeler/src/parameter_dialog.cpp +++ b/apps/modeler/src/parameter_dialog.cpp @@ -40,6 +40,13 @@ #include #include +#include +#include +#include +#include +#include +#include + ////////////////////////////////////////////////////////////////////////////////////////////// void pcl::modeler::ParameterDialog::addParameter(pcl::modeler::Parameter* parameter) @@ -56,7 +63,7 @@ pcl::modeler::ParameterDialog::addParameter(pcl::modeler::Parameter* parameter) } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::ParameterDialog::ParameterDialog(const std::string& title, QWidget* parent) : QDialog(parent), parameter_model_(NULL) +pcl::modeler::ParameterDialog::ParameterDialog(const std::string& title, QWidget* parent) : QDialog(parent), parameter_model_(nullptr) { setModal(false); setWindowTitle(QString(title.c_str())+" Parameters"); @@ -77,16 +84,14 @@ pcl::modeler::ParameterDialog::exec() QTableView tableView(this); tableView.setModel(¶meterModel); - size_t currentRow = 0; - for(std::map::iterator it = name_parameter_map_.begin(); - it != name_parameter_map_.end(); - ++ it) + std::size_t currentRow = 0; + for(const auto &name_parameter : name_parameter_map_) { QModelIndex name = parameterModel.index(int (currentRow), 0, QModelIndex()); - parameterModel.setData(name, QVariant(it->first.c_str())); + parameterModel.setData(name, QVariant(name_parameter.first.c_str())); QModelIndex value = parameterModel.index(int (currentRow), 1, QModelIndex()); - std::pair model_data = it->second->toModelData(); + std::pair model_data = name_parameter.second->toModelData(); parameterModel.setData(value, model_data.first, model_data.second); currentRow ++; @@ -96,11 +101,7 @@ pcl::modeler::ParameterDialog::exec() tableView.setItemDelegate(¶meterDelegate); tableView.horizontalHeader()->setStretchLastSection(true); -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) tableView.horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); -#else - tableView.horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); -#endif tableView.setShowGrid(true); tableView.verticalHeader()->hide(); tableView.setSelectionBehavior(QAbstractItemView::SelectRows); @@ -133,15 +134,13 @@ pcl::modeler::ParameterDialog::exec() void pcl::modeler::ParameterDialog::reset() { - size_t currentRow = 0; - for (std::map::iterator it = name_parameter_map_.begin(); - it != name_parameter_map_.end(); - ++ it) + std::size_t currentRow = 0; + for (auto &name_parameter : name_parameter_map_) { - it->second->reset(); + name_parameter.second->reset(); QModelIndex value = parameter_model_->index(int (currentRow), 1, QModelIndex()); - std::pair model_data = it->second->toModelData(); + std::pair model_data = name_parameter.second->toModelData(); parameter_model_->setData(value, model_data.first, model_data.second); currentRow ++; @@ -155,8 +154,8 @@ pcl::modeler::Parameter* pcl::modeler::ParameterDelegate::getCurrentParameter(co { std::map::iterator currentParameter = parameter_map_.begin(); - size_t currentRow = 0; - while(currentRow < (size_t) index.row() && currentParameter != parameter_map_.end()) { + std::size_t currentRow = 0; + while(currentRow < (std::size_t) index.row() && currentParameter != parameter_map_.end()) { ++ currentParameter; ++ currentRow; } diff --git a/apps/modeler/src/points_actor_item.cpp b/apps/modeler/src/points_actor_item.cpp index fbd94669..97aae691 100755 --- a/apps/modeler/src/points_actor_item.cpp +++ b/apps/modeler/src/points_actor_item.cpp @@ -47,7 +47,7 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::PointsActorItem::PointsActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, + const CloudMesh::Ptr& cloud_mesh, const vtkSmartPointer& render_window) :ChannelActorItem(parent, cloud_mesh, render_window, vtkSmartPointer::New(), "Points") { @@ -66,11 +66,7 @@ pcl::modeler::PointsActorItem::initImpl() poly_data_->SetPoints(cloud_mesh_->getVtkPoints()); vtkSmartPointer vertex_glyph_filter = vtkSmartPointer::New(); -#if VTK_MAJOR_VERSION < 6 - vertex_glyph_filter->AddInput(poly_data_); -#else vertex_glyph_filter->AddInputData (poly_data_); -#endif vertex_glyph_filter->Update(); vtkSmartPointer mapper = vtkSmartPointer::New(); @@ -87,7 +83,9 @@ pcl::modeler::PointsActorItem::initImpl() mapper->SetScalarModeToUsePointData(); mapper->InterpolateScalarsBeforeMappingOn(); mapper->ScalarVisibilityOn(); +#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 mapper->ImmediateModeRenderingOff(); +#endif vtkSmartPointer actor = vtkSmartPointer(dynamic_cast(actor_.GetPointer())); actor->SetMapper(mapper); diff --git a/apps/modeler/src/poisson_worker.cpp b/apps/modeler/src/poisson_worker.cpp index 9b305434..64bc2f83 100755 --- a/apps/modeler/src/poisson_worker.cpp +++ b/apps/modeler/src/poisson_worker.cpp @@ -45,13 +45,13 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::PoissonReconstructionWorker::PoissonReconstructionWorker(const QList& cloud_mesh_items, QWidget* parent) : AbstractWorker(cloud_mesh_items, parent), - depth_(NULL), solver_divide_(NULL), iso_divide_(NULL), degree_(NULL), scale_(NULL), samples_per_node_(NULL) + depth_(nullptr), solver_divide_(nullptr), iso_divide_(nullptr), degree_(nullptr), scale_(nullptr), samples_per_node_(nullptr) { } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::PoissonReconstructionWorker::~PoissonReconstructionWorker(void) +pcl::modeler::PoissonReconstructionWorker::~PoissonReconstructionWorker() { delete depth_; delete solver_divide_; diff --git a/apps/modeler/src/render_window.cpp b/apps/modeler/src/render_window.cpp index ab38f8e0..e72575da 100755 --- a/apps/modeler/src/render_window.cpp +++ b/apps/modeler/src/render_window.cpp @@ -64,7 +64,7 @@ pcl::modeler::RenderWindow::RenderWindow(RenderWindowItem* render_window_item, Q pcl::modeler::RenderWindow::~RenderWindow() { DockWidget* dock_widget = dynamic_cast(parent()); - if (dock_widget != NULL) + if (dock_widget != nullptr) { MainWindow::getInstance().removeDockWidget(dock_widget); dock_widget->deleteLater(); @@ -83,7 +83,7 @@ pcl::modeler::RenderWindow::initRenderer() // FPS callback //vtkSmartPointer txt = vtkSmartPointer::New (); - //typedef pcl::visualization::FPSCallback FPSCallback; + //using FPSCallback = pcl::visualization::FPSCallback; //vtkSmartPointer update_fps = vtkSmartPointer::New (); //update_fps->setTextActor (txt); //renderer->AddObserver (vtkCommand::EndEvent, update_fps); @@ -115,7 +115,7 @@ void pcl::modeler::RenderWindow::setActive(bool flag) { DockWidget* dock_widget = dynamic_cast(parent()); - if (dock_widget != NULL) + if (dock_widget != nullptr) dock_widget->setFocusBasedStyle(flag); return; @@ -126,7 +126,7 @@ void pcl::modeler::RenderWindow::setTitle(const QString& title) { DockWidget* dock_widget = dynamic_cast(parent()); - if (dock_widget != NULL) + if (dock_widget != nullptr) dock_widget->setWindowTitle(title); return; diff --git a/apps/modeler/src/render_window_item.cpp b/apps/modeler/src/render_window_item.cpp index 2536a38a..1c9e6cfb 100755 --- a/apps/modeler/src/render_window_item.cpp +++ b/apps/modeler/src/render_window_item.cpp @@ -45,7 +45,6 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::RenderWindowItem::RenderWindowItem(QTreeWidget * parent) : QTreeWidgetItem(parent), - AbstractItem(), render_window_(new RenderWindow(this)), background_color_(new ColorParameter("Background Color", "The background color of the render window", QColor(0, 0, 0))), show_axes_(new BoolParameter("Show Axes", "Show Axes", true)) @@ -82,7 +81,7 @@ pcl::modeler::RenderWindowItem::openPointCloud(const QString& filename) pcl::modeler::CloudMeshItem* pcl::modeler::RenderWindowItem::addPointCloud(CloudMesh::PointCloudPtr cloud) { - CloudMeshItem* cloud_mesh_item = new CloudMeshItem(this, cloud); + CloudMeshItem* cloud_mesh_item = new CloudMeshItem(this, std::move(cloud)); addChild(cloud_mesh_item); treeWidget()->setCurrentItem(cloud_mesh_item); diff --git a/apps/modeler/src/scene_tree.cpp b/apps/modeler/src/scene_tree.cpp index 7ab52eba..27462958 100755 --- a/apps/modeler/src/scene_tree.cpp +++ b/apps/modeler/src/scene_tree.cpp @@ -37,6 +37,11 @@ #include #include + +#include +#include +#include + #include #include #include @@ -79,7 +84,7 @@ pcl::modeler::SceneTree::~SceneTree() QSize pcl::modeler::SceneTree::sizeHint() const { - return QSize(256, 512); + return {256, 512}; } ////////////////////////////////////////////////////////////////////////////////////////////// @@ -119,13 +124,11 @@ pcl::modeler::SceneTree::openPointCloud(const QString& filename) { QList selected_render_window_items = selectedRenderWindowItems(); - for (QList::iterator selected_render_window_items_it = selected_render_window_items.begin(); - selected_render_window_items_it != selected_render_window_items.end(); - ++ selected_render_window_items_it) + for (auto &selected_render_window_item : selected_render_window_items) { - if(!(*selected_render_window_items_it)->openPointCloud(filename)) + if(!selected_render_window_item->openPointCloud(filename)) return (false); - expandItem(*selected_render_window_items_it); + expandItem(selected_render_window_item); } emit fileOpened(filename); @@ -166,12 +169,8 @@ pcl::modeler::SceneTree::slotOpenPointCloud() if (filenames.isEmpty()) return; - for (QList::iterator selected_render_window_items_it = selected_render_window_items.begin(); - selected_render_window_items_it != selected_render_window_items.end(); - ++ selected_render_window_items_it) + for (const auto &render_window_item : selected_render_window_items) { - RenderWindowItem* render_window_item = *selected_render_window_items_it; - QList cloud_mesh_items; for (int i = 0, i_end = render_window_item->childCount(); i < i_end; ++ i) cloud_mesh_items.push_back(dynamic_cast(render_window_item->child(i))); @@ -260,14 +259,10 @@ pcl::modeler::SceneTree::closePointCloud(const QList& items) { QList render_window_items; - for (QList::const_iterator items_it = items.begin(); - items_it != items.end(); - ++ items_it) + for (const auto &item : items) { - CloudMeshItem* item = *items_it; - RenderWindowItem* render_window_item = dynamic_cast(item->parent()); - if (render_window_item != NULL) + if (render_window_item != nullptr) render_window_items.push_back(render_window_item); item->parent()->removeChild(item); @@ -315,12 +310,10 @@ pcl::modeler::SceneTree::slotICPRegistration() ThreadController* thread_controller = new ThreadController(); QList selected_render_window_items = selectedRenderWindowItems(); - for (QList::iterator selected_render_window_items_it = selected_render_window_items.begin(); - selected_render_window_items_it != selected_render_window_items.end(); - ++ selected_render_window_items_it) + for (auto &selected_render_window_item : selected_render_window_items) { - CloudMeshItem* cloud_mesh_item = (*selected_render_window_items_it)->addPointCloud(result); - expandItem(*selected_render_window_items_it); + CloudMeshItem* cloud_mesh_item = selected_render_window_item->addPointCloud(result); + expandItem(selected_render_window_item); connect(worker, SIGNAL(finished()), new CloudMeshItemUpdater(cloud_mesh_item), SLOT(updateCloudMeshItem())); } @@ -401,7 +394,7 @@ pcl::modeler::SceneTree::slotUpdateOnSelectionChange(const QItemSelection & sele { QTreeWidgetItem* item = itemFromIndex(*selected_indices_it); RenderWindowItem* render_window_item = dynamic_cast(item); - if (render_window_item != NULL) + if (render_window_item != nullptr) { render_window_item->getRenderWindow()->setActive(true); } @@ -414,7 +407,7 @@ pcl::modeler::SceneTree::slotUpdateOnSelectionChange(const QItemSelection & sele { QTreeWidgetItem* item = itemFromIndex(*deselected_indices_it); RenderWindowItem* render_window_item = dynamic_cast(item); - if (render_window_item != NULL) + if (render_window_item != nullptr) { render_window_item->getRenderWindow()->setActive(false); } @@ -430,7 +423,7 @@ pcl::modeler::SceneTree::slotUpdateOnInsertOrRemove() for (int i = 0, i_end = topLevelItemCount(); i < i_end; ++ i) { RenderWindowItem* render_window_item = dynamic_cast(topLevelItem(i)); - if (render_window_item == NULL) + if (render_window_item == nullptr) continue; QString title = (i == 0)?("Central Render Window"):(QString("Render Window #%1").arg(i)); @@ -458,12 +451,10 @@ pcl::modeler::SceneTree::slotCloseRenderWindow() { QList selected_render_window_items = selectedTypeItems(); - for (QList::iterator selected_render_window_items_it = selected_render_window_items.begin(); - selected_render_window_items_it != selected_render_window_items.end(); - ++ selected_render_window_items_it) + for (auto &selected_render_window_item : selected_render_window_items) { - removeItemWidget((*selected_render_window_items_it), 0); - delete (*selected_render_window_items_it); + removeItemWidget(selected_render_window_item, 0); + delete selected_render_window_item; } emit itemInsertedOrRemoved(); @@ -478,25 +469,19 @@ pcl::modeler::SceneTree::dropEvent(QDropEvent * event) QList selected_cloud_meshes = selectedTypeItems(); std::set previous_parents; - for (QList::iterator selected_cloud_meshes_it = selected_cloud_meshes.begin(); - selected_cloud_meshes_it != selected_cloud_meshes.end(); - ++ selected_cloud_meshes_it) + for (const auto &cloud_mesh_item : selected_cloud_meshes) { - CloudMeshItem* cloud_mesh_item = *selected_cloud_meshes_it; RenderWindowItem* render_window_item = dynamic_cast(cloud_mesh_item->parent()); - if (render_window_item != NULL) + if (render_window_item != nullptr) previous_parents.insert(render_window_item); } QTreeWidget::dropEvent(event); std::vector cloud_mesh_items; - for (QList::iterator selected_cloud_meshes_it = selected_cloud_meshes.begin(); - selected_cloud_meshes_it != selected_cloud_meshes.end(); - ++ selected_cloud_meshes_it) + for (const auto &cloud_mesh_item : selected_cloud_meshes) { - CloudMeshItem* cloud_mesh_item = *selected_cloud_meshes_it; - if (dynamic_cast(cloud_mesh_item->parent()) == NULL) + if (dynamic_cast(cloud_mesh_item->parent()) == nullptr) cloud_mesh_items.push_back(cloud_mesh_item); else cloud_mesh_item->updateRenderWindow(); @@ -505,20 +490,18 @@ pcl::modeler::SceneTree::dropEvent(QDropEvent * event) // put the cloud mesh items in a new render window if (!cloud_mesh_items.empty()) { - for (size_t i = 0, i_end = cloud_mesh_items.size(); i < i_end; ++ i) - takeTopLevelItem(indexFromItem(cloud_mesh_items[i]).row()); + for (const auto &cloud_mesh_item : cloud_mesh_items) + takeTopLevelItem(indexFromItem(cloud_mesh_item).row()); RenderWindowItem* render_window_item = MainWindow::getInstance().createRenderWindow(); - for (size_t i = 0, i_end = cloud_mesh_items.size(); i < i_end; ++ i) - render_window_item->addChild(cloud_mesh_items[i]); + for (const auto &cloud_mesh_item : cloud_mesh_items) + render_window_item->addChild(cloud_mesh_item); render_window_item->setExpanded(true); } - for (std::set::iterator previous_parents_it = previous_parents.begin(); - previous_parents_it != previous_parents.end(); - ++ previous_parents_it) + for (const auto &previous_parent : previous_parents) { - (*previous_parents_it)->getRenderWindow()->updateAxes(); - (*previous_parents_it)->getRenderWindow()->render(); + previous_parent->getRenderWindow()->updateAxes(); + previous_parent->getRenderWindow()->render(); } return; @@ -531,13 +514,11 @@ pcl::modeler::SceneTree::dropMimeData(QTreeWidgetItem * parent, int, const QMime QList selected_cloud_meshes = selectedTypeItems(); RenderWindowItem* render_window_item = - (parent == NULL)?(MainWindow::getInstance().createRenderWindow()):(dynamic_cast(parent)); + (parent == nullptr)?(MainWindow::getInstance().createRenderWindow()):(dynamic_cast(parent)); - for (QList::iterator selected_cloud_meshes_it = selected_cloud_meshes.begin(); - selected_cloud_meshes_it != selected_cloud_meshes.end(); - ++ selected_cloud_meshes_it) + for (auto &selected_cloud_mesh : selected_cloud_meshes) { - CloudMeshItem* cloud_mesh_item_copy = new CloudMeshItem(render_window_item, *(*selected_cloud_meshes_it)); + CloudMeshItem* cloud_mesh_item_copy = new CloudMeshItem(render_window_item, *selected_cloud_mesh); render_window_item->addChild(cloud_mesh_item_copy); setCurrentItem(cloud_mesh_item_copy); } diff --git a/apps/modeler/src/statistical_outlier_removal_worker.cpp b/apps/modeler/src/statistical_outlier_removal_worker.cpp index 2ee160d7..b476da50 100755 --- a/apps/modeler/src/statistical_outlier_removal_worker.cpp +++ b/apps/modeler/src/statistical_outlier_removal_worker.cpp @@ -45,12 +45,12 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::StatisticalOutlierRemovalWorker::StatisticalOutlierRemovalWorker(const QList& cloud_mesh_items, QWidget* parent) : AbstractWorker(cloud_mesh_items, parent), - mean_k_(NULL), stddev_mul_thresh_(NULL) + mean_k_(nullptr), stddev_mul_thresh_(nullptr) { } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::StatisticalOutlierRemovalWorker::~StatisticalOutlierRemovalWorker(void) +pcl::modeler::StatisticalOutlierRemovalWorker::~StatisticalOutlierRemovalWorker() { delete mean_k_; delete stddev_mul_thresh_; diff --git a/apps/modeler/src/surface_actor_item.cpp b/apps/modeler/src/surface_actor_item.cpp index 6a8a9252..6681f496 100755 --- a/apps/modeler/src/surface_actor_item.cpp +++ b/apps/modeler/src/surface_actor_item.cpp @@ -47,8 +47,8 @@ ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::SurfaceActorItem::SurfaceActorItem(QTreeWidgetItem* parent, - const boost::shared_ptr& cloud_mesh, - const vtkSmartPointer& render_window) + const CloudMesh::Ptr& cloud_mesh, + const vtkSmartPointer& render_window) :ChannelActorItem(parent, cloud_mesh, render_window, vtkSmartPointer::New(), "Surface") { } @@ -71,11 +71,7 @@ pcl::modeler::SurfaceActorItem::initImpl() poly_data_->GetPointData ()->SetScalars (scalars); vtkSmartPointer mapper = vtkSmartPointer::New(); -#if VTK_MAJOR_VERSION < 6 - mapper->SetInput(poly_data_); -#else mapper->SetInputData (poly_data_); -#endif double minmax[2]; scalars->GetRange(minmax); @@ -84,7 +80,9 @@ pcl::modeler::SurfaceActorItem::initImpl() mapper->SetScalarModeToUsePointData (); mapper->InterpolateScalarsBeforeMappingOn (); mapper->ScalarVisibilityOn (); +#if VTK_RENDERING_BACKEND_OPENGL_VERSION < 2 mapper->ImmediateModeRenderingOff (); +#endif vtkSmartPointer actor = vtkSmartPointer(dynamic_cast(actor_.GetPointer())); actor->SetMapper(mapper); diff --git a/apps/modeler/src/thread_controller.cpp b/apps/modeler/src/thread_controller.cpp index 21fadf6c..8a2693a7 100755 --- a/apps/modeler/src/thread_controller.cpp +++ b/apps/modeler/src/thread_controller.cpp @@ -40,6 +40,8 @@ #include #include +#include +#include ////////////////////////////////////////////////////////////////////////////////////////////// pcl::modeler::ThreadController::ThreadController() @@ -48,7 +50,7 @@ pcl::modeler::ThreadController::ThreadController() } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::ThreadController::~ThreadController(void) +pcl::modeler::ThreadController::~ThreadController() { MainWindow::getInstance().slotOnWorkerFinished(); } @@ -91,4 +93,4 @@ void pcl::modeler::ThreadController::slotOnCloudMeshItemUpdate(CloudMeshItem* cloud_mesh_item) { cloud_mesh_item->updateChannels(); -} \ No newline at end of file +} diff --git a/apps/modeler/src/voxel_grid_downsample_worker.cpp b/apps/modeler/src/voxel_grid_downsample_worker.cpp index 161ca88c..6959e69d 100755 --- a/apps/modeler/src/voxel_grid_downsample_worker.cpp +++ b/apps/modeler/src/voxel_grid_downsample_worker.cpp @@ -49,12 +49,12 @@ pcl::modeler::VoxelGridDownampleWorker::VoxelGridDownampleWorker(const QList::max()), x_max_(std::numeric_limits::min()), y_min_(std::numeric_limits::max()), y_max_(std::numeric_limits::min()), z_min_(std::numeric_limits::max()), z_max_(std::numeric_limits::min()), - leaf_size_x_(NULL), leaf_size_y_(NULL), leaf_size_z_(NULL) + leaf_size_x_(nullptr), leaf_size_y_(nullptr), leaf_size_z_(nullptr) { } ////////////////////////////////////////////////////////////////////////////////////////////// -pcl::modeler::VoxelGridDownampleWorker::~VoxelGridDownampleWorker(void) +pcl::modeler::VoxelGridDownampleWorker::~VoxelGridDownampleWorker() { delete leaf_size_x_; delete leaf_size_y_; @@ -119,4 +119,4 @@ pcl::modeler::VoxelGridDownampleWorker::processImpl(CloudMeshItem* cloud_mesh_it emitDataUpdated(cloud_mesh_item); return; -} \ No newline at end of file +} diff --git a/apps/modeler/tools/CMakeLists.txt b/apps/modeler/tools/CMakeLists.txt deleted file mode 100755 index 139597f9..00000000 --- a/apps/modeler/tools/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/apps/optronic_viewer/CMakeLists.txt b/apps/optronic_viewer/CMakeLists.txt deleted file mode 100644 index 5767aa7e..00000000 --- a/apps/optronic_viewer/CMakeLists.txt +++ /dev/null @@ -1,108 +0,0 @@ -set(SUBSUBSYS_NAME optronic_viewer) -set(SUBSUBSYS_DESC "PCL Optronic Viewer") -set(SUBSUBSYS_DEPS common geometry io filters sample_consensus segmentation visualization kdtree features surface octree registration keypoints tracking search apps) - -# Find VTK and QVTK -if(VTK_FOUND AND VTK_USE_QVTK) - set(DEFAULT TRUE) - set(REASON) - set(VTK_USE_FILE "${VTK_USE_FILE}" CACHE INTERNAL "VTK_USE_FILE") - include("${VTK_USE_FILE}") -elseif(NOT VTK_FOUND) - set(DEFAULT AUTO_OFF) - set(REASON "VTK was not found.") -elseif(NOT VTK_USE_QVTK) - set(DEFAULT AUTO_OFF) - set(REASON "VTK was not built with Qt support.") -endif(VTK_FOUND AND VTK_USE_QVTK) - -# Find QT -if(NOT QT_USE_FILE) - set(DEFAULT AUTO_OFF) - set(REASON "Qt was not found.") -elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT TRUE) - set(REASON) -endif(NOT QT_USE_FILE) - -# FZAPI -if(FZAPI_FOUND) - set(DEFAULT TRUE) - set(REASON) -elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - set(DEFAULT AUTO_OFF) - set(REASON "FZAPI was not found.") -endif() - -# Default to not building for now -if (${DEFAULT} STREQUAL "TRUE") - set(DEFAULT FALSE) -endif() - -PCL_SUBSUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" ${DEFAULT} "${REASON}") -PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" DEPS ${SUBSUBSYS_DEPS} EXT_DEPS vtk) - -PCL_ADD_DOC("${SUBSUBSYS_NAME}") - -if(build) - - include_directories("${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include") - - # Set Qt files and resources here -# set(uis main_window.ui) - set(moc_incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/main_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/filter_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/openni_grabber.h") -# "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/scene_tree.h" -# "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/parameter_dialog.h" -# "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/thread_controller.h" -# "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/abstract_worker.h" -# "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_mesh_item_updater.h") - -# set(resources resources/resources.qrc) - -# set(incs ${moc_incs}) - set(incs "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/qt.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/openni_grabber.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/cloud_filter.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/main_window.h" - "include/pcl/${SUBSYS_NAME}/${SUBSUBSYS_NAME}/filter_window.h") - - set(srcs src/main.cpp - src/cloud_filter.cpp - src/openni_grabber.cpp - src/filter_window.cpp - src/main_window.cpp) - - set(impl_incs ) - - # Qt stuff -# QT4_WRAP_UI(ui_srcs ${uis}) - QT4_WRAP_CPP(moc_srcs ${moc_incs} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) -# QT4_ADD_RESOURCES(resource_srcs ${resources}) - - # Organize files -# SOURCE_GROUP("Resources" FILES ${uis} ${resources} ${EXE_ICON}) -# SOURCE_GROUP("Generated" FILES ${ui_srcs} ${moc_srcs} ${resource_srcs} ${RCS_SOURCES}) -# SET_SOURCE_FILES_PROPERTIES(${srcs} PROPERTIES OBJECT_DEPENDS "${ui_srcs}") - - # Generate executable - set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") -# PCL_ADD_EXECUTABLE("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${ui_srcs} ${moc_srcs} ${resource_srcs} ${srcs} ${incs} ${impl_incs}) - PCL_ADD_EXECUTABLE("${EXE_NAME}" "${SUBSUBSYS_NAME}" ${moc_srcs} ${srcs} ${incs} ${impl_incs}) - target_link_libraries("${EXE_NAME}" pcl_common pcl_io pcl_kdtree pcl_filters pcl_visualization pcl_segmentation pcl_surface pcl_features pcl_sample_consensus pcl_search QVTK ${QT_LIBRARIES}) - - # Put the ui in the windows project file - IF("${CMAKE_BUILD_TOOL}" MATCHES "msdev") - LIST(APPEND srcs ${uis}) - ELSEIF("${CMAKE_BUILD_TOOL}" MATCHES "devenv") - LIST(APPEND srcs ${uis}) - ENDIF("${CMAKE_BUILD_TOOL}" MATCHES "msdev") - - # Install include files - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${incs}) - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSUBSYS_NAME}/impl" ${impl_incs}) - - PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "") - -endif(build) diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h deleted file mode 100644 index 8c28f7a7..00000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/cloud_filter.h +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef PCL_APPS_OPTRONIC_VIEWER_CLOUD_FILTER_H_ -#define PCL_APPS_OPTRONIC_VIEWER_CLOUD_FILTER_H_ - -#include -#include -#include - -#include - -#include - -#include -#include - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - ///////////////////////////////////////////////////////////////////////// - /** \brief Interface for a class that implements a filter for a point - * cloud. - */ - class CloudFilter - { - public: - virtual ~CloudFilter () {} - - /** \brief Applies the filter on the input and stores the result in the - * output cloud. - */ - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) = 0; - - /** \brief Returns the name of the filter. */ - virtual std::string - getName () - { - return name_; - } - - /** \brief Sets the name of the filter. */ - virtual void - setName (std::string & name) - { - name_ = name; - } - - /** \brief Returns a Qt page which allows to configure the filter. */ - virtual QWizardPage * - getParameterPage () = 0; - - protected: - /** \brief The name of the filter. */ - std::string name_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Factory class to create a filter. */ - class CloudFilterFactory - { - public: - virtual ~CloudFilterFactory () {} - - /** \brief Returns the name of the filter type. */ - virtual std::string - getName () - { - return filter_type_name_; - } - - /** \brief Creates a filter object. */ - virtual CloudFilter* - create () = 0; - - protected: - /** \brief Constructor which sets the filter type name. */ - CloudFilterFactory (std::string name) - : filter_type_name_ (name) - {} - - protected: - /** \brief Filter type name */ - std::string filter_type_name_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Helper class for the factory to simplify implementation of - * new cloud filters. This class makes the implementation of a - * separate factory class obsolete, e.g.: - * - * Header: - * char g_voxel_grid_cf_name[]; - * typedef CloudFilterFactory2 VoxelGridCFF2; - * - * Source: - * extern char pcl::apps::optronic_viewer::g_voxel_grid_cf_name[] = "VoxelGrid Filter"; - */ - template - class CloudFilterFactory2 - : public CloudFilterFactory - { - public: - /** \brief Creates a new cloud factory with the name specified in - * the template parameter. - */ - CloudFilterFactory2 () : CloudFilterFactory (name) {} - virtual ~CloudFilterFactory2 () {} - - /** \brief Creates a new filter object. */ - virtual CloudFilter* - create () - { - return (new T ()); - } - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a voxel grid filter. Divides the space in voxels - * and takes a point per voxel. - */ - class VoxelGridCF - : public CloudFilter - { - public: - VoxelGridCF (); - virtual ~VoxelGridCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - // filter parameters - float voxel_grid_size_x_; - float voxel_grid_size_y_; - float voxel_grid_size_z_; - - QLabel * voxel_grid_size_x_label_; - QLabel * voxel_grid_size_y_label_; - QLabel * voxel_grid_size_z_label_; - QLineEdit * voxel_grid_size_x_line_edit_; - QLineEdit * voxel_grid_size_y_line_edit_; - QLineEdit * voxel_grid_size_z_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a pass-through filter. Removes all points that are - * out of a specified range for a specified component (e.g. x, y, - * or z). - */ - class PassThroughCF - : public CloudFilter - { - public: - PassThroughCF (); - virtual ~PassThroughCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - std::string filter_field_name_; - float filter_limits_min_; - float filter_limits_max_; - - QLabel * filter_field_name_label_; - QLabel * filter_limits_min_label_; - QLabel * filter_limits_max_label_; - QLineEdit * filter_field_name_line_edit_; - QLineEdit * filter_limits_min_line_edit_; - QLineEdit * filter_limits_max_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a radius-outlier filter. Removes all points that - * have less than a specified number of points as neighbors - * (within a specified radius). - */ - class RadiusOutlierCF - : public CloudFilter - { - public: - RadiusOutlierCF (); - virtual ~RadiusOutlierCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - float search_radius_; - int min_neighbors_in_radius_; - - QLabel * search_radius_label_; - QLabel * min_neighbors_in_radius_label_; - QLineEdit * search_radius_line_edit_; - QLineEdit * min_neighbors_in_radius_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for the fast-bilateral filter. Applies the fast- - * bilateral filter on a cloud for smoothing. - */ - class FastBilateralCF - : public CloudFilter - { - public: - FastBilateralCF (); - virtual ~FastBilateralCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - float sigma_s_; - float sigma_r_; - - QLabel * sigma_s_label_; - QLabel * sigma_r_label_; - QLineEdit * sigma_s_line_edit_; - QLineEdit * sigma_r_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a Median filter. Applies the Median filter on a - * cloud. - */ - class MedianCF - : public CloudFilter - { - public: - MedianCF (); - virtual ~MedianCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - float max_allowed_movement_; - int window_size_; - - QLabel * max_allowed_movement_label_; - QLabel * window_size_label_; - QLineEdit * max_allowed_movement_line_edit_; - QLineEdit * window_size_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a random sample filter. Selects a random sample - * of points from the input cloud. - */ - class RandomSampleCF - : public CloudFilter - { - public: - RandomSampleCF (); - virtual ~RandomSampleCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - int seed_; - int sample_; - - QLabel * seed_label_; - QLabel * sample_label_; - QLineEdit * seed_line_edit_; - QLineEdit * sample_line_edit_; - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - ///////////////////////////////////////////////////////////////////////// - /** \brief Wrapper for a filter that finds the dominant plane in the - * cloud and either keeps only the plane or everything else. - */ - class PlaneCF - : public CloudFilter - { - public: - PlaneCF (); - virtual ~PlaneCF (); - - virtual void - filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out); - - virtual QWizardPage * - getParameterPage () - { - return (filter_selection_page_); - } - - protected: - double threshold_; - int max_iterations_; - - double refinement_sigma_; - int max_refinement_iterations_; - - bool return_negative_; - - double cluster_tolerance_; - int min_cluster_size_; - - QLabel * threshold_label_; - QLabel * max_iterations_label_; - QLabel * refinement_sigma_label_; - QLabel * max_refinement_iterations_label_; - QLabel * return_negative_label_; - QLabel * cluster_tolerance_label_; - QLabel * min_cluster_size_label_; - - QLineEdit * threshold_line_edit_; - QLineEdit * max_iterations_line_edit_; - QLineEdit * refinement_sigma_line_edit_; - QLineEdit * max_refinement_iterations_line_edit_; - QCheckBox * return_negative_check_box_; - QLineEdit * cluster_tolerance_line_edit_; - QLineEdit * min_cluster_size_line_edit_; - - QVBoxLayout * main_layout_; - QWizardPage * filter_selection_page_; - }; - - - ///////////////////////////////////////////////////////////////////////// - char g_voxel_grid_cf_name[]; - char g_passthrough_cf_name[]; - char g_radius_outlier_cf_name[]; - char g_fast_bilateral_cf_name[]; - char g_median_cf_name[]; - char g_random_sample_cf_name[]; - char g_plane_cf_name[]; - - ///////////////////////////////////////////////////////////////////////// - typedef CloudFilterFactory2< VoxelGridCF, g_voxel_grid_cf_name> VoxelGridCFF2; - typedef CloudFilterFactory2< PassThroughCF, g_passthrough_cf_name> PassThroughCFF2; - typedef CloudFilterFactory2< RadiusOutlierCF, g_radius_outlier_cf_name> RadiusOutlierCFF2; - typedef CloudFilterFactory2< FastBilateralCF, g_fast_bilateral_cf_name> FastBilateralCFF2; - typedef CloudFilterFactory2< MedianCF, g_median_cf_name> MedianCFF2; - typedef CloudFilterFactory2< RandomSampleCF, g_random_sample_cf_name> RandomSampleCFF2; - typedef CloudFilterFactory2< PlaneCF, g_plane_cf_name> PlaneCFF2; - - } - } -} - -#endif // PCL_APPS_OPTRONIC_VIEWER_CLOUD_FILTER_H_ diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h deleted file mode 100644 index d92618c0..00000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/filter_window.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef PCL_APPS_OPTRONIC_VIEWER_FILTER_WINDOW_H_ -#define PCL_APPS_OPTRONIC_VIEWER_FILTER_WINDOW_H_ - -#include - -#include -#include -#include -#include -#include - -#include - - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - /** \brief Window class for wizards to create new filters. */ - class FilterWindow : public QWizard - { - Q_OBJECT - - public: - /** \brief Creates a new wizard for creating a filter. The filter to be - * created can be selected from the specified list of filters. - * The supplied factories are used to create the corresponding - * filters. - */ - FilterWindow ( - std::vector & filter_factories, - std::vector & filter_list); - virtual ~FilterWindow (); - - public Q_SLOTS: - /** \brief Called if a different item in the filter list is selected. */ - virtual void itemSelected (int id); - /** \brief Called when the 'finish' button is pressed. */ - virtual void finished (); - /** \brief Called when the 'next' button is pressed. */ - virtual void next (); - - Q_SIGNALS: - /** \brief Omitted when a filter is created. */ - void filterCreated (); - - protected: - virtual void cleanupPage (int id) - { - std::cerr << "cleanup page" << std::endl; - } - - private: - /** \brief Creates the page for selecting filters. */ - void createFilterSelectionPage (); - /** \brief Fills the combo box used for selecting filters. */ - void fillFilterSelectionComboBox (QComboBox * combo_box); - - private: - /** \brief List of filter factories used to create the available filters. */ - std::vector filter_factories_; - - /** \brief Combo box that holds the names of the available filters. */ - QComboBox * filter_selection_combo_box_; - /** \brief Line edit used to specify the name of the created filter. */ - QLineEdit * filter_name_line_edit_; - - int last_added_page_id_; - - /** \brief The destination for the newly created filter. */ - std::vector * filter_list_; - - /** \brief The filter to be created. */ - CloudFilter * filter_; - }; - } - } -} - -#endif // PCL_APPS_OPTRONIC_VIEWER_FILTER_WINDOW_H_ diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h deleted file mode 100644 index 3da12a63..00000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/main_window.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef PCL_APPS_OPTRONIC_VIEWER_MAIN_WINDOW_H_ -#define PCL_APPS_OPTRONIC_VIEWER_MAIN_WINDOW_H_ - -#include - -#include -#include -#include -#include -#include - -#include - - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - enum DeviceType - { - OPENNI_DEVICE, - FOTONIC_DEVICE - }; - - class Device - { - public: - Device (DeviceType arg_device_type) - : device_type (arg_device_type) - {} - virtual ~Device () {} - - DeviceType device_type; - }; - - class OpenNIDevice - : public Device - { - public: - OpenNIDevice () - : Device (OPENNI_DEVICE) - {} - virtual ~OpenNIDevice () {} - - int device_id; - std::string name; - std::string vendor; - std::string serial_number; - }; - - class FotonicDevice - : public Device - { - public: - FotonicDevice () - : Device (FOTONIC_DEVICE) - {} - virtual ~FotonicDevice () {} - - FZ_DEVICE_INFO device_info; - }; - - - class MainWindow : public QMainWindow - { - Q_OBJECT - - public: - static MainWindow& getInstance() { - static MainWindow theSingleton; - return theSingleton; - } - - public Q_SLOTS: - void selectedSensorChanged (int index); - void cloud_callback (const pcl::PointCloud::ConstPtr cloud); - void refresh (); - void refreshFilterList (); - - private: - // create the file menu in the menu bar - void createFileMenu (); - - // find connected devices - void findConnectedDevices (); - - private Q_SLOTS: - void addFilter (); - void updateFilter (QListWidgetItem*); - void filterSelectionChanged (); - - void moveFilterUp (); - void moveFilterDown (); - void removeFilter (); - - private: - MainWindow(); - MainWindow(const MainWindow &) : QMainWindow () {} // copy ctor hidden - MainWindow& operator=(const MainWindow &) { return (*this); } // assign op. hidden - ~MainWindow(); - - // visualization of processing chain - QListWidget * processing_list_; - - // buttons to change processing chain - QPushButton * up_ ; - QPushButton * down_; - QPushButton * remove_; - - // visualization of point clouds - QVTKWidget * qvtk_widget_; - pcl::visualization::PCLVisualizer * pcl_visualizer_; - pcl::PointCloud::ConstPtr cloud_; - - // connected devices - std::vector connected_devices_; - - // Grabber stuff - //std::vector connected_openni_devices_; - pcl::Grabber * grabber_; - pcl::apps::optronic_viewer::OpenNIGrabber * grabber_thread_; - - // filters - std::vector filter_factories_; - std::vector active_cloud_filters_; - - // mutexes - boost::mutex cloud_mutex_; - }; - } - } -} - -#endif // PCL_APPS_OPTRONIC_VIEWER_MAIN_WINDOW_H_ diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h deleted file mode 100644 index 9963a7a7..00000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/openni_grabber.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef PCL_APPS_OPTRONIC_VIEWER_OPENNI_GRABBER_H_ -#define PCL_APPS_OPTRONIC_VIEWER_OPENNI_GRABBER_H_ - -#include -#include -#include - -#include - -#include - - -namespace pcl -{ - namespace apps - { - namespace optronic_viewer - { - - /** \brief Wrapper for the grabbing from an OpenNI device. Wrapper is used to run - * the grabbing in a separate thread (QThread). - */ - class OpenNIGrabber : public QThread - { - Q_OBJECT - - public: - /** \brief Creates a new wrapper object from the specified grabber. */ - OpenNIGrabber (pcl::Grabber * grabber); - virtual ~OpenNIGrabber (); - - /** \brief Starts the thread. */ - void run (); - - /** \brief Callback that is used to get cloud data from the grabber. */ - void cloudCallback (const pcl::PointCloud::ConstPtr & cloud); - - Q_SIGNALS: - /** \brief Omitted when a new cloud is received. */ - void cloudReceived (const pcl::PointCloud::ConstPtr cloud); - - private: - /** \brief The grabber data is received from. */ - pcl::Grabber * grabber_; - }; - - } - } -} - -#endif // PCL_APPS_OPTRONIC_VIEWER_OPENNI_GRABBER_H_ diff --git a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h b/apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h deleted file mode 100644 index 140ff70a..00000000 --- a/apps/optronic_viewer/include/pcl/apps/optronic_viewer/qt.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef PCL_APPS_OPTRONIC_VIEWER_QT_H_ -#define PCL_APPS_OPTRONIC_VIEWER_QT_H_ - -#ifdef __GNUC__ -#pragma GCC system_header -#endif - -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#endif // PCL_APPS_OPTRONIC_VIEWER_QT_H_ diff --git a/apps/optronic_viewer/src/cloud_filter.cpp b/apps/optronic_viewer/src/cloud_filter.cpp deleted file mode 100644 index 19e9003b..00000000 --- a/apps/optronic_viewer/src/cloud_filter.cpp +++ /dev/null @@ -1,662 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -extern char pcl::apps::optronic_viewer::g_voxel_grid_cf_name[] = "VoxelGrid Filter"; -extern char pcl::apps::optronic_viewer::g_passthrough_cf_name[] = "PassThrough Filter"; -extern char pcl::apps::optronic_viewer::g_radius_outlier_cf_name[] = "RadiusOutlier Filter"; -extern char pcl::apps::optronic_viewer::g_fast_bilateral_cf_name[] = "Fast Bilateral Filter"; -extern char pcl::apps::optronic_viewer::g_median_cf_name[] = "Median Filter"; -extern char pcl::apps::optronic_viewer::g_random_sample_cf_name[] = "Random Sample Filter"; -extern char pcl::apps::optronic_viewer::g_plane_cf_name[] = "Plane Filter"; - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -VoxelGridCF:: -VoxelGridCF () -: filter_selection_page_ (new QWizardPage ()) -, voxel_grid_size_x_ (0.01) -, voxel_grid_size_y_ (0.01) -, voxel_grid_size_z_ (0.01) -{ - voxel_grid_size_x_label_ = new QLabel (QObject::tr ("Voxel Grid Size in X-Direction:")); - voxel_grid_size_x_line_edit_ = new QLineEdit (); - voxel_grid_size_y_label_ = new QLabel (QObject::tr ("Voxel Grid Size in Y-Direction:")); - voxel_grid_size_y_line_edit_ = new QLineEdit (); - voxel_grid_size_z_label_ = new QLabel (QObject::tr ("Voxel Grid Size in Z-Direction:")); - voxel_grid_size_z_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - voxel_grid_size_x_line_edit_->setValidator (double_validator); - voxel_grid_size_y_line_edit_->setValidator (double_validator); - voxel_grid_size_z_line_edit_->setValidator (double_validator); - - std::stringstream ss_x; - ss_x << voxel_grid_size_x_; - voxel_grid_size_x_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << voxel_grid_size_y_; - voxel_grid_size_y_line_edit_->setText (QString (ss_y.str ().c_str ())); - - std::stringstream ss_z; - ss_z << voxel_grid_size_z_; - voxel_grid_size_z_line_edit_->setText (QString (ss_z.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (voxel_grid_size_x_label_); - main_layout_->addWidget (voxel_grid_size_x_line_edit_); - main_layout_->addWidget (voxel_grid_size_y_label_); - main_layout_->addWidget (voxel_grid_size_y_line_edit_); - main_layout_->addWidget (voxel_grid_size_z_label_); - main_layout_->addWidget (voxel_grid_size_z_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -VoxelGridCF:: -~VoxelGridCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -VoxelGridCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - voxel_grid_size_x_ = voxel_grid_size_x_line_edit_->text ().toFloat (); - voxel_grid_size_y_ = voxel_grid_size_y_line_edit_->text ().toFloat (); - voxel_grid_size_z_ = voxel_grid_size_z_line_edit_->text ().toFloat (); - - pcl::VoxelGrid sor; - sor.setInputCloud (cloud_in); - sor.setLeafSize (voxel_grid_size_x_, voxel_grid_size_y_, voxel_grid_size_z_); - sor.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PassThroughCF:: -PassThroughCF () -: filter_selection_page_ (new QWizardPage ()) -, filter_field_name_ ("z") -, filter_limits_min_ (0) -, filter_limits_max_ (5) -{ - filter_field_name_label_ = new QLabel (QObject::tr ("Filter Field Name:")); - filter_field_name_line_edit_ = new QLineEdit (); - filter_limits_min_label_ = new QLabel (QObject::tr ("Filter Limit - Minimum:")); - filter_limits_min_line_edit_ = new QLineEdit (); - filter_limits_max_label_ = new QLabel (QObject::tr ("Filter Limit - Maximum:")); - filter_limits_max_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - filter_limits_min_line_edit_->setValidator (double_validator); - filter_limits_max_line_edit_->setValidator (double_validator); - - std::stringstream ss_x; - ss_x << filter_field_name_; - filter_field_name_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << filter_limits_min_; - filter_limits_min_line_edit_->setText (QString (ss_y.str ().c_str ())); - - std::stringstream ss_z; - ss_z << filter_limits_max_; - filter_limits_max_line_edit_->setText (QString (ss_z.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (filter_field_name_label_); - main_layout_->addWidget (filter_field_name_line_edit_); - main_layout_->addWidget (filter_limits_min_label_); - main_layout_->addWidget (filter_limits_min_line_edit_); - main_layout_->addWidget (filter_limits_max_label_); - main_layout_->addWidget (filter_limits_max_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PassThroughCF:: -~PassThroughCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -PassThroughCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - filter_field_name_ = filter_field_name_line_edit_->text ().toStdString (); - filter_limits_min_ = filter_limits_min_line_edit_->text ().toFloat (); - filter_limits_max_ = filter_limits_max_line_edit_->text ().toFloat (); - - pcl::PassThrough filter; - filter.setInputCloud (cloud_in); - filter.setFilterFieldName (filter_field_name_); - filter.setFilterLimits (filter_limits_min_, filter_limits_max_); - filter.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RadiusOutlierCF:: -RadiusOutlierCF () -: filter_selection_page_ (new QWizardPage ()) -, search_radius_ (0.05f) -, min_neighbors_in_radius_ (500) -{ - search_radius_label_ = new QLabel (QObject::tr ("Search Radius:")); - search_radius_line_edit_ = new QLineEdit (); - min_neighbors_in_radius_label_ = new QLabel (QObject::tr ("Minimum Number of Neighbors within Radius:")); - min_neighbors_in_radius_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - QIntValidator * int_validator = new QIntValidator (); - search_radius_line_edit_->setValidator (double_validator); - min_neighbors_in_radius_line_edit_->setValidator (int_validator); - - std::stringstream ss_x; - ss_x << search_radius_; - search_radius_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << min_neighbors_in_radius_; - min_neighbors_in_radius_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (search_radius_label_); - main_layout_->addWidget (search_radius_line_edit_); - main_layout_->addWidget (min_neighbors_in_radius_label_); - main_layout_->addWidget (min_neighbors_in_radius_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RadiusOutlierCF:: -~RadiusOutlierCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -RadiusOutlierCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - search_radius_ = search_radius_line_edit_->text ().toFloat (); - min_neighbors_in_radius_ = min_neighbors_in_radius_line_edit_->text ().toInt (); - - pcl::RadiusOutlierRemoval filter; - filter.setInputCloud (cloud_in); - filter.setRadiusSearch (search_radius_); - filter.setMinNeighborsInRadius (min_neighbors_in_radius_); - filter.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FastBilateralCF:: -FastBilateralCF () -: filter_selection_page_ (new QWizardPage ()) -, sigma_s_ (5.0f) -, sigma_r_ (0.03f) -{ - sigma_s_label_ = new QLabel (QObject::tr ("Half Size (sigma s) (Minimum: 1.0):")); - sigma_s_line_edit_ = new QLineEdit (); - sigma_r_label_ = new QLabel (QObject::tr ("Standard Deviation (sigma r) (Minimum: 0.0001):")); - sigma_r_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - sigma_s_line_edit_->setValidator (double_validator); - sigma_r_line_edit_->setValidator (double_validator); - - std::stringstream ss_x; - ss_x << sigma_s_; - sigma_s_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << sigma_r_; - sigma_r_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (sigma_s_label_); - main_layout_->addWidget (sigma_s_line_edit_); - main_layout_->addWidget (sigma_r_label_); - main_layout_->addWidget (sigma_r_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FastBilateralCF:: -~FastBilateralCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FastBilateralCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - sigma_s_ = sigma_s_line_edit_->text ().toFloat (); - sigma_r_ = sigma_r_line_edit_->text ().toFloat (); - - //std::cerr << "sigma_s: " << sigma_s_ << std::endl; - //std::cerr << "sigma_r: " << sigma_r_ << std::endl; - - if (sigma_s_ <= 1.0f) - sigma_s_ = 1.0f; - if (sigma_r_ <= 0.0001f) - sigma_r_ = 0.0001f; - - pcl::FastBilateralFilter fbf; - fbf.setInputCloud (cloud_in); - fbf.setSigmaS (sigma_s_); - fbf.setSigmaR (sigma_r_); - fbf.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MedianCF:: -MedianCF () -: filter_selection_page_ (new QWizardPage ()) -, max_allowed_movement_ (1.0f) -, window_size_ (1) -{ - max_allowed_movement_label_ = new QLabel (QObject::tr ("Maximum Allowed Movement (Minimum: 0.0):")); - max_allowed_movement_line_edit_ = new QLineEdit (); - window_size_label_ = new QLabel (QObject::tr ("Window Size (Minimum: 1):")); - window_size_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - QIntValidator * int_validator = new QIntValidator (); - max_allowed_movement_line_edit_->setValidator (double_validator); - window_size_line_edit_->setValidator (int_validator); - - std::stringstream ss_x; - ss_x << max_allowed_movement_; - max_allowed_movement_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << window_size_; - window_size_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (max_allowed_movement_label_); - main_layout_->addWidget (max_allowed_movement_line_edit_); - main_layout_->addWidget (window_size_label_); - main_layout_->addWidget (window_size_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MedianCF:: -~MedianCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MedianCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - max_allowed_movement_ = max_allowed_movement_line_edit_->text ().toFloat (); - window_size_ = window_size_line_edit_->text ().toInt (); - - if (max_allowed_movement_ <= 0.0f) - max_allowed_movement_ = 0.0f; - if (window_size_ < 1) - window_size_ = 1; - - pcl::MedianFilter fbf; - fbf.setInputCloud (cloud_in); - fbf.setMaxAllowedMovement (max_allowed_movement_); - fbf.setWindowSize (window_size_); - fbf.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RandomSampleCF:: -RandomSampleCF () -: filter_selection_page_ (new QWizardPage ()) -, seed_ (1) -, sample_ (1000) -{ - seed_label_ = new QLabel (QObject::tr ("Seed for Random Number Generator:")); - seed_line_edit_ = new QLineEdit (); - sample_label_ = new QLabel (QObject::tr ("Number of Samples drawn from the Input Cloud:")); - sample_line_edit_ = new QLineEdit (); - - QIntValidator * int_validator = new QIntValidator (); - seed_line_edit_->setValidator (int_validator); - sample_line_edit_->setValidator (int_validator); - - std::stringstream ss_x; - ss_x << seed_; - seed_line_edit_->setText (QString (ss_x.str ().c_str ())); - - std::stringstream ss_y; - ss_y << sample_; - sample_line_edit_->setText (QString (ss_y.str ().c_str ())); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (seed_label_); - main_layout_->addWidget (seed_line_edit_); - main_layout_->addWidget (sample_label_); - main_layout_->addWidget (sample_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -RandomSampleCF:: -~RandomSampleCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -RandomSampleCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - seed_ = seed_line_edit_->text ().toFloat (); - sample_ = sample_line_edit_->text ().toInt (); - - if (sample_ < 1) - sample_ = 1; - - pcl::RandomSample fbf; - fbf.setInputCloud (cloud_in); - fbf.setSeed (seed_); - fbf.setSample (sample_); - fbf.filter (*cloud_out); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -//############################################################################################ -//############################################################################################ -////////////////////////////////////////////////////////////////////////////////////////////// - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PlaneCF:: -PlaneCF () -: filter_selection_page_ (new QWizardPage ()) -, threshold_ (0.05f) -, max_iterations_ (1000) -, refinement_sigma_ (2) -, max_refinement_iterations_ (50) -, return_negative_ (false) -, cluster_tolerance_ (0.02) -, min_cluster_size_ (100) -{ - threshold_label_ = new QLabel (QObject::tr ("Threshold for plane detection:")); - threshold_line_edit_ = new QLineEdit (); - max_iterations_label_ = new QLabel (QObject::tr ("Maximum number of iterations for plane estimation:")); - max_iterations_line_edit_ = new QLineEdit (); - refinement_sigma_label_ = new QLabel (QObject::tr ("Sigma for plane parameter refinement:")); - refinement_sigma_line_edit_ = new QLineEdit (); - max_refinement_iterations_label_ = new QLabel (QObject::tr ("Maximum number of iterations for plane parameter refinement:")); - max_refinement_iterations_line_edit_ = new QLineEdit (); - return_negative_label_ = new QLabel (QObject::tr ("Invert filter (return everything except plane)?")); - return_negative_check_box_ = new QCheckBox (); - cluster_tolerance_label_ = new QLabel (QObject::tr ("Cluster tolerance for plane segmentation:")); - cluster_tolerance_line_edit_ = new QLineEdit (); - min_cluster_size_label_ = new QLabel (QObject::tr ("Minimum cluster size:")); - min_cluster_size_line_edit_ = new QLineEdit (); - - QDoubleValidator * double_validator = new QDoubleValidator (); - QIntValidator * int_validator = new QIntValidator (); - threshold_line_edit_->setValidator (double_validator); - refinement_sigma_line_edit_->setValidator (double_validator); - cluster_tolerance_line_edit_->setValidator (double_validator); - max_iterations_line_edit_->setValidator (int_validator); - max_refinement_iterations_line_edit_->setValidator (int_validator); - min_cluster_size_line_edit_->setValidator (int_validator); - - { - std::stringstream ss; - ss << threshold_; - threshold_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << max_iterations_; - max_iterations_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << refinement_sigma_; - refinement_sigma_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << max_refinement_iterations_; - max_refinement_iterations_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << cluster_tolerance_; - cluster_tolerance_line_edit_->setText (QString (ss.str ().c_str ())); - } - { - std::stringstream ss; - ss << min_cluster_size_; - min_cluster_size_line_edit_->setText (QString (ss.str ().c_str ())); - } - - if (return_negative_) - return_negative_check_box_->setCheckState (Qt::Checked); - else - return_negative_check_box_->setCheckState (Qt::Unchecked); - - main_layout_ = new QVBoxLayout (filter_selection_page_); - main_layout_->addWidget (threshold_label_); - main_layout_->addWidget (threshold_line_edit_); - main_layout_->addWidget (max_iterations_label_); - main_layout_->addWidget (max_iterations_line_edit_); - main_layout_->addWidget (refinement_sigma_label_); - main_layout_->addWidget (refinement_sigma_line_edit_); - main_layout_->addWidget (max_refinement_iterations_label_); - main_layout_->addWidget (max_refinement_iterations_line_edit_); - main_layout_->addWidget (return_negative_label_); - main_layout_->addWidget (return_negative_check_box_); - main_layout_->addWidget (cluster_tolerance_label_); - main_layout_->addWidget (cluster_tolerance_line_edit_); - main_layout_->addWidget (min_cluster_size_label_); - main_layout_->addWidget (min_cluster_size_line_edit_); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -PlaneCF:: -~PlaneCF () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -PlaneCF:: -filter ( - pcl::PointCloud::ConstPtr &cloud_in, - pcl::PointCloud::Ptr &cloud_out) -{ - threshold_ = threshold_line_edit_->text ().toFloat (); - max_iterations_ = max_iterations_line_edit_->text ().toInt (); - refinement_sigma_ = refinement_sigma_line_edit_->text ().toFloat (); - max_refinement_iterations_ = max_refinement_iterations_line_edit_->text ().toInt (); - cluster_tolerance_ = cluster_tolerance_line_edit_->text ().toFloat (); - min_cluster_size_ = min_cluster_size_line_edit_->text ().toInt (); - - if (max_iterations_ < 0) - max_iterations_ = 0; - if (max_refinement_iterations_ < 0) - max_refinement_iterations_ = 0; - - if (cluster_tolerance_ < 0.0001) - cluster_tolerance_ = 0.0001; - - return_negative_ = return_negative_check_box_->checkState () == Qt::Checked; - - pcl::SampleConsensusModelPlane::Ptr model (new pcl::SampleConsensusModelPlane (cloud_in)); - pcl::RandomSampleConsensus sac (model, threshold_); - sac.setMaxIterations (max_iterations_); - bool res = sac.computeModel (); - - std::vector inliers; - sac.getInliers (inliers); - - if (!res || inliers.empty ()) - { - std::cerr << "no planar model found!" << std::endl; - return; - } - - sac.refineModel (refinement_sigma_, max_refinement_iterations_); - sac.getInliers (inliers); - - if (return_negative_) - { - pcl::PointIndices::Ptr everything_but_the_plane (new pcl::PointIndices ()); - std::vector indices_fullset (cloud_in->size ()); - for (int p_it = 0; p_it < static_cast (indices_fullset.size ()); ++p_it) - indices_fullset[p_it] = p_it; - - std::sort (inliers.begin (), inliers.end ()); - std::set_difference (indices_fullset.begin (), indices_fullset.end (), - inliers.begin (), inliers.end (), - inserter (everything_but_the_plane->indices, everything_but_the_plane->indices.begin ())); - - // Extract largest cluster minus the plane - std::vector cluster_indices; - pcl::EuclideanClusterExtraction ec; - ec.setClusterTolerance (cluster_tolerance_); - ec.setMinClusterSize (min_cluster_size_); - ec.setInputCloud (cloud_in); - ec.setIndices (everything_but_the_plane); - ec.extract (cluster_indices); - - if (!cluster_indices.empty ()) - { - // Convert data back - pcl::copyPointCloud (*cloud_in, cluster_indices[0].indices, *cloud_out); - } - } - else - { - pcl::copyPointCloud (*cloud_in, inliers, *cloud_out); - } -} - - - - - - diff --git a/apps/optronic_viewer/src/filter_window.cpp b/apps/optronic_viewer/src/filter_window.cpp deleted file mode 100644 index b7bd09dd..00000000 --- a/apps/optronic_viewer/src/filter_window.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include -#include - -#include -#include - -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FilterWindow:: -FilterWindow (std::vector & filter_factories, std::vector & filter_list) -: filter_factories_ (filter_factories) -, filter_selection_combo_box_ (NULL) -, filter_list_ (&filter_list) -, filter_ (NULL) -{ - this->setOption (QWizard::IndependentPages, true); - - createFilterSelectionPage (); - - filter_ = filter_factories_[0]->create (); - - QString name (filter_factories_[0]->getName ().c_str ()); - filter_name_line_edit_->setText (name); - - if (filter_factories.size () > 0) - last_added_page_id_ = this->addPage (filter_->getParameterPage ()); - - connect (this->button (FinishButton), SIGNAL (released ()),this, SLOT (finished ())); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -FilterWindow:: -~FilterWindow () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -itemSelected (int id) -{ - std::cerr << "item " << id << " selected" << std::endl; - - delete filter_; - filter_ = filter_factories_[id]->create (); - - QString name (filter_factories_[id]->getName ().c_str ()); - filter_name_line_edit_->setText (name); - - int tmp = this->addPage (filter_->getParameterPage ()); - this->removePage (last_added_page_id_); - last_added_page_id_ = tmp; - this->update (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -finished () -{ - std::cerr << "finished" << std::endl; - - filter_->setName (filter_name_line_edit_->text ().toStdString ()); - filter_list_->push_back (filter_); - - emit filterCreated (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -next () -{ - std::cerr << "next" << std::endl; - this->QWizard::next (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -createFilterSelectionPage () -{ - QWizardPage * filter_selection_page = new QWizardPage (); - - QLabel * select_filter_label = new QLabel (tr ("Select Filter:")); - filter_selection_combo_box_ = new QComboBox (); - - if (filter_factories_.empty ()) - filter_selection_combo_box_->addItem (tr ("none")); - else - fillFilterSelectionComboBox (filter_selection_combo_box_); - - connect (filter_selection_combo_box_, SIGNAL (currentIndexChanged (int)),this, SLOT (itemSelected (int))); - - QLabel * filter_name_label = new QLabel (tr ("Filter Name:")); - filter_name_line_edit_ = new QLineEdit (); - - QVBoxLayout * main_layout = new QVBoxLayout (filter_selection_page); - main_layout->addWidget (select_filter_label); - main_layout->addWidget (filter_selection_combo_box_); - main_layout->addWidget (filter_name_label); - main_layout->addWidget (filter_name_line_edit_); - - this->addPage (filter_selection_page); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -FilterWindow:: -fillFilterSelectionComboBox (QComboBox * combo_box) -{ - for (int factory_index = 0; factory_index < filter_factories_.size (); ++factory_index) - { - std::string name = filter_factories_[factory_index]->getName (); - - combo_box->addItem (tr (name.c_str ())); - } -} diff --git a/apps/optronic_viewer/src/main.cpp b/apps/optronic_viewer/src/main.cpp deleted file mode 100644 index d38bfada..00000000 --- a/apps/optronic_viewer/src/main.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include - -int main( int argc, char** argv ) -{ - QApplication app( argc, argv ); - app.setOrganizationName("PCL"); - app.setApplicationName("PCL Optronic Viewer"); - - pcl::apps::optronic_viewer::MainWindow::getInstance().show(); - - return app.exec(); -} diff --git a/apps/optronic_viewer/src/main_window.cpp b/apps/optronic_viewer/src/main_window.cpp deleted file mode 100644 index ef5f6769..00000000 --- a/apps/optronic_viewer/src/main_window.cpp +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MainWindow:: -MainWindow () - : grabber_ (NULL) - , grabber_thread_ (NULL) -{ - // initialize API - pcl::FotonicGrabber::initAPI (); - - - // setup filters - filter_factories_.push_back (new VoxelGridCFF2 ()); - filter_factories_.push_back (new PassThroughCFF2 ()); - filter_factories_.push_back (new RadiusOutlierCFF2 ()); - filter_factories_.push_back (new FastBilateralCFF2 ()); - filter_factories_.push_back (new MedianCFF2 ()); - filter_factories_.push_back (new RandomSampleCFF2 ()); - filter_factories_.push_back (new PlaneCFF2 ()); - - - // reset point cloud - cloud_.reset (new pcl::PointCloud ()); - - - // set window title - this->setWindowTitle ("PCL Optronic Viewer"); - - - // setup menu - this->createFileMenu (); - - - // setup widgets - QWidget * central_widget = new QWidget (this); - - QLabel * sensor_label = new QLabel (tr ("Sensor")); - QComboBox * sensor_selection_combo_box = new QComboBox (); - sensor_selection_combo_box->addItem (tr ("none")); - this->findConnectedDevices (); - for (size_t device_idx = 0; device_idx < connected_devices_.size (); ++device_idx) - { - if (connected_devices_[device_idx]->device_type == OPENNI_DEVICE) - sensor_selection_combo_box->addItem (tr (reinterpret_cast (connected_devices_[device_idx])->name.c_str ())); - if (connected_devices_[device_idx]->device_type == FOTONIC_DEVICE) - sensor_selection_combo_box->addItem (tr (reinterpret_cast (connected_devices_[device_idx])->device_info.szPath)); - } - connect (sensor_selection_combo_box, SIGNAL(activated (int)), this, SLOT(selectedSensorChanged (int))); - - processing_list_ = new QListWidget (central_widget); - connect (processing_list_, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (updateFilter (QListWidgetItem*))); - connect (processing_list_, SIGNAL (itemSelectionChanged ()), this, SLOT (filterSelectionChanged ())); - - - up_ = new QPushButton ("up"); - down_ = new QPushButton ("down"); - remove_ = new QPushButton ("remove"); - - connect (up_, SIGNAL (clicked ()), this, SLOT (moveFilterUp ())); - connect (down_, SIGNAL (clicked ()), this, SLOT (moveFilterDown ())); - connect (remove_, SIGNAL (clicked ()), this, SLOT (removeFilter ())); - - up_->setEnabled (false); - down_->setEnabled (false); - remove_->setEnabled (false); - - pcl_visualizer_ = new pcl::visualization::PCLVisualizer ("", false); - qvtk_widget_ = new QVTKWidget (central_widget); - qvtk_widget_->SetRenderWindow (pcl_visualizer_->getRenderWindow ()); - pcl_visualizer_->setupInteractor (qvtk_widget_->GetInteractor (), qvtk_widget_->GetRenderWindow ()); - qvtk_widget_->update (); - - - // setup layouts - QHBoxLayout * sensor_layout = new QHBoxLayout (); - sensor_layout->addWidget (sensor_label, 0, Qt::AlignLeft); - sensor_layout->addWidget (sensor_selection_combo_box, 1); - - QHBoxLayout * button_layout = new QHBoxLayout (); - button_layout->addWidget (up_); - button_layout->addWidget (down_); - button_layout->addWidget (remove_); - - QVBoxLayout * sensor_processing_list_layout = new QVBoxLayout (); - sensor_processing_list_layout->addLayout (sensor_layout, 0); - sensor_processing_list_layout->addWidget (processing_list_); - sensor_processing_list_layout->addLayout (button_layout, 0); - - QHBoxLayout * main_layout = new QHBoxLayout (central_widget); - main_layout->addLayout (sensor_processing_list_layout, 0); - main_layout->addWidget (qvtk_widget_, 1); - - this->resize (1024, 600); - this->setCentralWidget (central_widget); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -MainWindow:: -~MainWindow () -{ - // exit Fotonic API - pcl::FotonicGrabber::exitAPI (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -createFileMenu () -{ - // File menu - QAction * exit_act = new QAction (tr ("E&xit"), this); - exit_act->setStatusTip (tr ("Closes the viewer")); - connect(exit_act, SIGNAL(triggered()), this, SLOT(close ())); - - QMenu * file_menu = this->menuBar ()->addMenu (tr ("&File")); - file_menu->addAction (exit_act); - - - // Process menu - QAction * add_filter_act = new QAction (tr ("Add &Filter"), this); - add_filter_act->setStatusTip (tr ("Adds a filter")); - connect(add_filter_act, SIGNAL (triggered ()), this, SLOT (addFilter ())); - - QMenu * process_menu = this->menuBar ()->addMenu (tr ("&Process")); - process_menu->addAction (add_filter_act); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -findConnectedDevices () -{ - connected_devices_.clear (); - - std::cerr << "Check for OpenNI devices..." << std::endl; - openni_wrapper::OpenNIDriver& driver = openni_wrapper::OpenNIDriver::getInstance(); - if (driver.getNumberDevices() > 0) - { - std::cerr << "Connected devices:" << std::endl; - for (unsigned device_idx = 0; device_idx < driver.getNumberDevices(); ++device_idx) - { - std::cout << " Device: " << device_idx + 1 << ", vendor: " << driver.getVendorName(device_idx) << ", product: " << driver.getProductName(device_idx) - << ", connected: " << driver.getBus(device_idx) << " @ " << driver.getAddress(device_idx) << ", serial number: \'" << driver.getSerialNumber(device_idx) << "\'" << endl; - - OpenNIDevice * device = new OpenNIDevice (); - device->device_id = device_idx + 1; - device->name = driver.getProductName (device_idx); - device->vendor = driver.getVendorName(device_idx); - device->serial_number = driver.getSerialNumber(device_idx); - - connected_devices_.push_back (device); - } - - } - else - std::cout << "No devices connected." << endl; - - - std::cerr << "Check for Fotonic devices..." << std::endl; - std::vector fotonic_devices = pcl::FotonicGrabber::enumDevices (); - for (int device_index = 0; device_index < fotonic_devices.size (); ++device_index) - { - FotonicDevice * device = new FotonicDevice (); - - device->device_info.iDeviceType = fotonic_devices[device_index].iDeviceType; - memcpy (device->device_info.szPath, fotonic_devices[device_index].szPath, sizeof (fotonic_devices[device_index].szPath[0])*512); - memcpy (device->device_info.szSerial, fotonic_devices[device_index].szSerial, sizeof (fotonic_devices[device_index].szSerial[0])*16); - memcpy (device->device_info.szShortName, fotonic_devices[device_index].szShortName, sizeof (fotonic_devices[device_index].szShortName[0])*32); - - std::cerr << "device id " << device_index << std::endl; - std::cerr << " device type: " << fotonic_devices[device_index].iDeviceType << std::endl; - std::cerr << " device path: " << fotonic_devices[device_index].szPath << std::endl; - std::cerr << " device serial: " << fotonic_devices[device_index].szSerial << std::endl; - std::cerr << " device short name: " << fotonic_devices[device_index].szShortName << std::endl; - - connected_devices_.push_back (device); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -selectedSensorChanged (int index) -{ - std::cerr << "selected sensor changed to " << index << std::endl; - - // stop old grabber - if (grabber_ != NULL) - { - if (grabber_->isRunning ()) - grabber_->stop (); - } - - // stop old grabber thread - if (grabber_thread_ != NULL) - { - disconnect (grabber_thread_, SIGNAL(cloudReceived (const pcl::PointCloud::ConstPtr)), this, SLOT(cloud_callback (const pcl::PointCloud::ConstPtr))); - grabber_thread_->terminate (); - - delete grabber_thread_; - grabber_thread_ = NULL; - } - - // delete old grabber - if (grabber_ != NULL) - { - delete grabber_; - grabber_ = NULL; - } - - if (index != 0) - { - if (connected_devices_[index-1]->device_type == OPENNI_DEVICE) - { - std::stringstream ss; - ss << "#" << reinterpret_cast (connected_devices_[index-1])->device_id; - - grabber_ = new pcl::OpenNIGrabber (ss.str ()); - - } - - if (connected_devices_[index-1]->device_type == FOTONIC_DEVICE) - { - grabber_ = new pcl::FotonicGrabber (reinterpret_cast (connected_devices_[index-1])->device_info); - } - - grabber_thread_ = new pcl::apps::optronic_viewer::OpenNIGrabber (grabber_); - grabber_thread_->start (); - connect (grabber_thread_, SIGNAL(cloudReceived (const pcl::PointCloud::ConstPtr)), this, SLOT(cloud_callback (const pcl::PointCloud::ConstPtr))); - - QTimer::singleShot (30, this, SLOT(refresh ())); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -refresh () -{ - QTime now; - now.start(); - - if (cloud_mutex_.try_lock ()) - { - // apply filters - pcl::PointCloud::ConstPtr cloud_in = cloud_; - pcl::PointCloud::Ptr cloud_out (new pcl::PointCloud ()); - for (int i = 0; i < active_cloud_filters_.size (); ++i) - { - active_cloud_filters_[i]->filter (cloud_in, cloud_out); - cloud_in = cloud_out; - cloud_out.reset (new pcl::PointCloud ()); - } - - // only update if cloud is not empty, otherwise the reset of the camera - // viewpoint won't work when initially selecting a sensor - if (!cloud_in->empty ()) - { - // visualize - if (!pcl_visualizer_->updatePointCloud (cloud_in, "OpenNICloud")) - { - pcl_visualizer_->addPointCloud (cloud_in, "OpenNICloud"); - pcl_visualizer_->resetCameraViewpoint ("OpenNICloud"); - } - } - cloud_mutex_.unlock (); - } - qvtk_widget_->GetRenderWindow ()->Render (); - - int elapsed_time = now.elapsed (); - int time = 30 - elapsed_time; - - std::cerr << "elapsed time: " << elapsed_time << std::endl; - - if (time < 0) - time = 0; - - QTimer::singleShot (time, this, SLOT(refresh ())); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -cloud_callback (const pcl::PointCloud::ConstPtr cloud) -{ - //std::cerr << "cloud received" << std::endl; - - if (cloud_mutex_.try_lock ()) - { - cloud_ = cloud; - cloud_mutex_.unlock (); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -addFilter () -{ - std::cerr << "add filter..." << std::endl; - - // open window to select new filter - pcl::apps::optronic_viewer::FilterWindow * filter_dialog = new pcl::apps::optronic_viewer::FilterWindow (filter_factories_, active_cloud_filters_); - filter_dialog->setWindowTitle (tr ("Add Filter...")); - - connect (filter_dialog, SIGNAL (filterCreated ()), this, SLOT (refreshFilterList ())); - - filter_dialog->show (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -updateFilter (QListWidgetItem * item) -{ - int id = processing_list_->row (item); - - QWizard * wizard = new QWizard (); - wizard->addPage (active_cloud_filters_[id]->getParameterPage ()); - wizard->show (); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -filterSelectionChanged () -{ - std::cerr << "filter selection changed..." << std::endl; - - QList selected_items = processing_list_->selectedItems (); - - std::cerr << "number of selected items: " << selected_items.size () << std::endl; - - if (selected_items.size () != 0) - { - int row = processing_list_->row (selected_items[0]); - std::cerr << "selected filter: " << row << std::endl; - - if (row != 0) - up_->setEnabled (true); - else - up_->setEnabled (false); - - const int list_size = active_cloud_filters_.size (); - if (row != list_size-1) - down_->setEnabled (true); - else - down_->setEnabled (false); - - remove_->setEnabled (true); - } - else - { - up_->setEnabled (false); - down_->setEnabled (false); - remove_->setEnabled (false); - } -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -moveFilterUp () -{ - std::cerr << "move filter up" << std::endl; - - QList selected_items = processing_list_->selectedItems (); - int change_id = processing_list_->row (selected_items[0]); - - pcl::apps::optronic_viewer::CloudFilter* tmp = active_cloud_filters_[change_id]; - active_cloud_filters_[change_id] = active_cloud_filters_[change_id-1]; - active_cloud_filters_[change_id-1] = tmp; - - refreshFilterList (); - - processing_list_->setCurrentRow (change_id-1); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -moveFilterDown () -{ - std::cerr << "move filter down" << std::endl; - - QList selected_items = processing_list_->selectedItems (); - int change_id = processing_list_->row (selected_items[0]); - - pcl::apps::optronic_viewer::CloudFilter* tmp = active_cloud_filters_[change_id]; - active_cloud_filters_[change_id] = active_cloud_filters_[change_id+1]; - active_cloud_filters_[change_id+1] = tmp; - - refreshFilterList (); - - processing_list_->setCurrentRow (change_id+1); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -removeFilter () -{ - std::cerr << "remove filter" << std::endl; - - QList selected_items = processing_list_->selectedItems (); - int remove_id = processing_list_->row (selected_items[0]); - - pcl::apps::optronic_viewer::CloudFilter* tmp = active_cloud_filters_[remove_id]; - active_cloud_filters_.erase (active_cloud_filters_.begin()+remove_id); - refreshFilterList (); - - cloud_mutex_.lock (); - delete tmp; - cloud_mutex_.unlock (); - - if (active_cloud_filters_.size () > remove_id) - processing_list_->setCurrentRow (remove_id); - else - processing_list_->setCurrentRow (remove_id-1); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -MainWindow:: -refreshFilterList () -{ - processing_list_->clear (); - std::cerr << "filters: " << std::endl; - for (int i = 0; i < active_cloud_filters_.size (); ++i) - { - std::cerr << " " << active_cloud_filters_[i]->getName () << std::endl; - processing_list_->addItem (QString (active_cloud_filters_[i]->getName ().c_str ())); - } -} diff --git a/apps/optronic_viewer/src/openni_grabber.cpp b/apps/optronic_viewer/src/openni_grabber.cpp deleted file mode 100644 index 44ea38c0..00000000 --- a/apps/optronic_viewer/src/openni_grabber.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Software License Agreement (BSD License) - * - * Point Cloud Library (PCL) - www.pointclouds.org - * Copyright (c) 2012-, Open Perception, Inc. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of the copyright holder(s) nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include - -#include - - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -OpenNIGrabber (pcl::Grabber * grabber) - : QThread () - , grabber_ (grabber) -{ - qRegisterMetaType::ConstPtr> ("pcl::PointCloud::ConstPtr"); -} - -////////////////////////////////////////////////////////////////////////////////////////////// -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -~OpenNIGrabber () -{ -} - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -run () -{ - std::cerr << "run grabber thread..." << std::endl; - boost::function::ConstPtr & cloud) > f = - boost::bind (&pcl::apps::optronic_viewer::OpenNIGrabber::cloudCallback, this, _1); - boost::signals2::connection c1 = grabber_->registerCallback (f); - grabber_->start (); -} - - -////////////////////////////////////////////////////////////////////////////////////////////// -void -pcl::apps::optronic_viewer:: -OpenNIGrabber:: -cloudCallback (const pcl::PointCloud::ConstPtr & cloud) -{ - //std::cerr << "[grabber thread] cloud received.." << std::endl; - emit cloudReceived (cloud); -} - - diff --git a/apps/point_cloud_editor/CMakeLists.txt b/apps/point_cloud_editor/CMakeLists.txt index 7c027567..cb749b65 100644 --- a/apps/point_cloud_editor/CMakeLists.txt +++ b/apps/point_cloud_editor/CMakeLists.txt @@ -1,119 +1,113 @@ -SET(SUBSUBSYS_NAME point_cloud_editor) -SET(SUBSUBSYS_DESC "Point Cloud Editor - Simple editor for 3D point clouds") -SET(SUBSUBSYS_DEPS common filters io apps) - -SET(MOC_INCS "include/pcl/apps/${SUBSUBSYS_NAME}/cloudEditorWidget.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/mainWindow.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/denoiseParameterForm.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/statisticsDialog.h" - ) - -SET(RSRC resources/pceditor_resources.qrc) - -SET(INCS ${MOC_INCS} - "include/pcl/apps/${SUBSUBSYS_NAME}/cloud.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/cloudTransformTool.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/command.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/commandQueue.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/common.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/copyBuffer.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/copyCommand.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/cutCommand.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/deleteCommand.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/denoiseCommand.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/localTypes.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/pasteCommand.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/select1DTool.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/select2DTool.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/selection.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/selectionTransformTool.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/statistics.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/toolInterface.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/trackball.h" - "include/pcl/apps/${SUBSUBSYS_NAME}/transformCommand.h" - ) - -SET(SRCS src/main.cpp - src/mainWindow.cpp - src/commandQueue.cpp - src/selection.cpp - src/copyBuffer.cpp - src/deleteCommand.cpp - src/cutCommand.cpp - src/pasteCommand.cpp - src/cloud.cpp - src/cloudEditorWidget.cpp - src/cloudTransformTool.cpp - src/select1DTool.cpp - src/select2DTool.cpp - src/selectionTransformTool.cpp - src/transformCommand.cpp - src/common.cpp - src/denoiseCommand.cpp - src/statistics.cpp - src/statisticsDialog.cpp - src/trackball.cpp - src/denoiseParameterForm.cpp - ) - -IF(NOT QT4_FOUND) - SET(DEFAULT AUTO_OFF) - SET(REASON "Qt4 was not found.") -ELSE(NOT QT4_FOUND) - SET(DEFAULT TRUE) - SET(REASON) -ENDIF(NOT QT4_FOUND) +set(SUBSUBSYS_NAME point_cloud_editor) +set(SUBSUBSYS_DESC "Point Cloud Editor - Simple editor for 3D point clouds") +set(SUBSUBSYS_DEPS common filters io apps) + +# QT5 Found? +if(NOT Qt5_FOUND) + set(DEFAULT AUTO_OFF) + set(REASON "Qt5 was not found.") +elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") + set(DEFAULT TRUE) + set(REASON) +endif() # Find OpenGL -IF(NOT OPENGL_FOUND) - SET(DEFAULT AUTO_OFF) - SET(REASON "OpenGL was not found.") -ELSEIF(NOT ${DEFAULT} STREQUAL "AUTO_OFF") - SET(DEFAULT TRUE) - SET(REASON) -ENDIF(NOT OPENGL_FOUND) +if(NOT OPENGL_FOUND) + set(DEFAULT AUTO_OFF) + set(REASON "OpenGL was not found.") +elseif(NOT ${DEFAULT} STREQUAL "AUTO_OFF") + set(DEFAULT TRUE) + set(REASON) +endif() # Default to not building for now -if (${DEFAULT} STREQUAL "TRUE") +if(${DEFAULT} STREQUAL "TRUE") set(DEFAULT FALSE) endif() -PCL_SUBSUBSYS_OPTION(BUILD "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") -PCL_SUBSUBSYS_DEPEND(BUILD "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${SUBSYS_DEPS}) +PCL_SUBSUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}") +PCL_SUBSUBSYS_DEPEND(build "${SUBSYS_NAME}" "${SUBSUBSYS_NAME}" ${SUBSYS_DEPS}) PCL_ADD_DOC(${SUBSUBSYS_NAME}) -IF(BUILD) - INCLUDE("${QT_USE_FILE}") - SET(QT_USE_QTOPENGL TRUE) - #QT4_WRAP_CPP(MOC_SRCS ${MOC_INCS}) - QT4_WRAP_CPP(MOC_SRCS ${MOC_INCS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) - QT4_ADD_RESOURCES(RESOURCES_SRCS ${RSRC}) - - INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}" - "${CMAKE_CURRENT_SOURCE_DIR}/include" - "${QT_QTOPENGL_INCLUDE_DIR}" - ) - - SET(EXE_NAME "pcl_${SUBSUBSYS_NAME}") - PCL_ADD_EXECUTABLE("${EXE_NAME}" - "${SUBSUBSYS_NAME}" - ${SRCS} - ${RESOURCES_SRCS} - ${MOC_SRCS} - ${INCS} - ) - - TARGET_LINK_LIBRARIES("${EXE_NAME}" - ${QT_LIBRARIES} - ${QT_QTOPENGL_LIBRARY} - ${OPENGL_LIBRARIES} - ${BOOST_LIBRARIES} - pcl_common - pcl_io - pcl_filters - ) - - PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}" ${INCS}) - PCL_MAKE_PKGCONFIG("${EXE_NAME}" "${SUBSUBSYS_NAME}" "${SUBSUBSYS_DESC}" "" "" "" "" "") -ENDIF(BUILD) +if(NOT build) + return() +endif() + +set(MOC_INCS + "include/pcl/apps/${SUBSUBSYS_NAME}/cloudEditorWidget.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/mainWindow.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/denoiseParameterForm.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/statisticsDialog.h" +) + +set(RSRC + resources/pceditor_resources.qrc +) + +set(INCS ${MOC_INCS} + "include/pcl/apps/${SUBSUBSYS_NAME}/cloud.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/cloudTransformTool.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/command.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/commandQueue.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/common.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/copyBuffer.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/copyCommand.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/cutCommand.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/deleteCommand.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/denoiseCommand.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/localTypes.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/pasteCommand.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/select1DTool.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/select2DTool.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/selection.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/selectionTransformTool.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/statistics.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/toolInterface.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/trackball.h" + "include/pcl/apps/${SUBSUBSYS_NAME}/transformCommand.h" +) + +set(SRCS + src/main.cpp + src/mainWindow.cpp + src/commandQueue.cpp + src/selection.cpp + src/copyBuffer.cpp + src/deleteCommand.cpp + src/cutCommand.cpp + src/pasteCommand.cpp + src/cloud.cpp + src/cloudEditorWidget.cpp + src/cloudTransformTool.cpp + src/select1DTool.cpp + src/select2DTool.cpp + src/selectionTransformTool.cpp + src/transformCommand.cpp + src/common.cpp + src/denoiseCommand.cpp + src/statistics.cpp + src/statisticsDialog.cpp + src/trackball.cpp + src/denoiseParameterForm.cpp +) + +qt5_wrap_cpp(MOC_SRCS ${MOC_INCS} OPTIONS -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) +qt5_add_resources(RESOURCES_SRCS ${RSRC}) + +include_directories( + "${CMAKE_CURRENT_BINARY_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/include" +) + +set(EXE_NAME "pcl_${SUBSUBSYS_NAME}") +PCL_ADD_EXECUTABLE(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} SOURCES ${SRCS} ${RESOURCES_SRCS} ${MOC_SRCS} ${INCS}) + +target_link_libraries("${EXE_NAME}" Qt5::Widgets Qt5::OpenGL ${OPENGL_LIBRARIES} ${BOOST_LIBRARIES} pcl_common pcl_io pcl_filters) + +PCL_ADD_INCLUDES("${SUBSUBSYS_NAME}" "${SUBSYS_NAME}/${SUBSUBSYS_NAME}" ${INCS}) +PCL_MAKE_PKGCONFIG(${EXE_NAME} COMPONENT ${SUBSUBSYS_NAME} DESC ${SUBSUBSYS_DESC}) + +# Add to the compound apps target +list(APPEND PCL_APPS_ALL_TARGETS ${EXE_NAME}) +set(PCL_APPS_ALL_TARGETS ${PCL_APPS_ALL_TARGETS} PARENT_SCOPE) diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloud.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloud.h index 654cd3a7..7eb55cba 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloud.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloud.h @@ -39,8 +39,7 @@ /// display. /// @author Yue Li and Matthew Hielsberg -#ifndef CLOUD_H_ -#define CLOUD_H_ +#pragma once #include #include @@ -91,9 +90,6 @@ class Cloud : public Statistics /// variables of this object are initialized but not set. Cloud (const Cloud3D& cloud, bool register_stats=false); - /// @brief Destructor - ~Cloud (); - /// @brief Equal Operator /// @details Deep copies all the state of the passed cloud to this cloud. /// @param cloud The cloud object whose status to be copied to this object @@ -205,7 +201,7 @@ class Cloud : public Statistics /// a faster rendering mode; this also occurs if the selection object is /// empty. void - setSelection (SelectionPtr selection_ptr); + setSelection (const SelectionPtr& selection_ptr); /// @brief Sets the RGB values for coloring points in COLOR_BY_PURE mode. /// @param r the value for red color @@ -373,7 +369,7 @@ class Cloud : public Statistics /// @brief Get statistics of the selected points in string. std::string - getStat () const; + getStat () const override; /// Default Point Size static const float DEFAULT_POINT_DISPLAY_SIZE_; @@ -416,7 +412,7 @@ class Cloud : public Statistics /// @brief A weak pointer pointing to the selection object. /// @details This implementation uses the weak pointer to allow for a lazy /// update of the cloud if the selection object is destroyed. - boost::weak_ptr selection_wk_ptr_; + std::weak_ptr selection_wk_ptr_; /// Flag that indicates whether a color ramp should be used (true) or not /// (false) when displaying the cloud @@ -472,8 +468,3 @@ class Cloud : public Statistics /// The translations on x, y, and z axis on the selected points. float select_translate_x_, select_translate_y_, select_translate_z_; }; -#endif // CLOUD_H_ - - - - diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h index 32e6f5ce..9c2002ee 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudEditorWidget.h @@ -38,11 +38,8 @@ /// which are used for viewing and editing point clouds /// @author Yue Li and Matthew Hielsberg -#ifndef CLOUD_EDITOR_WIDGET_H_ -#define CLOUD_EDITOR_WIDGET_H_ +#pragma once -#include -#include #include #include #include @@ -50,6 +47,10 @@ #include #include +#include + +#include + /// @brief class declaration for the widget for editing and viewing /// point clouds. class CloudEditorWidget : public QGLWidget @@ -58,7 +59,7 @@ class CloudEditorWidget : public QGLWidget public: /// @brief Constructor /// @param parent a pointer which points to the parent widget - CloudEditorWidget (QWidget *parent = 0); + CloudEditorWidget (QWidget *parent = nullptr); /// @brief Destructor ~CloudEditorWidget (); @@ -190,31 +191,31 @@ class CloudEditorWidget : public QGLWidget protected: /// initializes GL void - initializeGL (); + initializeGL () override; /// the rendering function. void - paintGL (); + paintGL () override; /// resizes widget void - resizeGL (int width, int height); + resizeGL (int width, int height) override; /// mouse press control void - mousePressEvent (QMouseEvent *event); + mousePressEvent (QMouseEvent *event) override; /// mouse move control void - mouseMoveEvent (QMouseEvent *event); + mouseMoveEvent (QMouseEvent *event) override; /// mouse release control void - mouseReleaseEvent (QMouseEvent *event); + mouseReleaseEvent (QMouseEvent *event) override; /// key press control void - keyPressEvent (QKeyEvent *event); + keyPressEvent (QKeyEvent *event) override; private: @@ -252,9 +253,10 @@ class CloudEditorWidget : public QGLWidget return lhs.compare(rhs) < 0; } }; - typedef boost::function - FileLoadFunc; - typedef std::map FileLoadMap; + + using FileLoadFunc = std::function; + using FileLoadMap = std::map; + /// a map of file type extensions to loader functions. FileLoadMap cloud_load_func_map_; @@ -269,7 +271,7 @@ class CloudEditorWidget : public QGLWidget /// The transformation tool being used. Either a cloud transform tool or /// a selection transform tool is activated at a time. - boost::shared_ptr tool_ptr_; + std::shared_ptr tool_ptr_; /// a pointer to the selection object SelectionPtr selection_ptr_; @@ -302,7 +304,8 @@ class CloudEditorWidget : public QGLWidget /// A flag indicates whether the cloud is initially colored or not. bool is_colored_; - typedef boost::function KeyMapFunc; + using KeyMapFunc = std::function; + /// map between pressed key and the corresponding functor std::map key_map_; @@ -311,4 +314,3 @@ class CloudEditorWidget : public QGLWidget }; -#endif // CLOUD_EDITOR_WIDGET_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h index 51ab68bb..e3c38f1a 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cloudTransformTool.h @@ -38,8 +38,7 @@ /// transformation matrix using inputs from the mouse. /// @author Yue Li and Matthew Hielsberg -#ifndef CLOUD_TRANSFORM_TOOL_H_ -#define CLOUD_TRANSFORM_TOOL_H_ +#pragma once #include #include @@ -67,7 +66,7 @@ class CloudTransformTool : public ToolInterface /// @param buttons The state of the mouse buttons. This function does not /// make use of this parameter. void - start (int x, int y, BitMask modifiers, BitMask buttons); + start (int x, int y, BitMask modifiers, BitMask buttons) override; /// @brief Updates the transform matrix of this object with mouse screen /// coordinates and key modifiers. @@ -88,20 +87,20 @@ class CloudTransformTool : public ToolInterface /// @param buttons The LEFT mouse button must be pressed for any transform /// to be generated. All other buttons are ignored. void - update (int x, int y, BitMask modifiers, BitMask buttons); + update (int x, int y, BitMask modifiers, BitMask buttons) override; /// @brief Updates the transform matrix of this object with mouse screen /// coordinates and key modifiers. Then right multiplies the cloud_matrix_ /// matrix of the cloud object with the transform matrix of this object. /// @details This function is not required by this tool void - end (int, int, BitMask, BitMask) + end (int, int, BitMask, BitMask) override { } /// @brief This function does nothing for this cloud transform tool. void - draw() const + draw() const override { } @@ -146,4 +145,3 @@ class CloudTransformTool : public ToolInterface /// default translation factor static const float DEFAULT_TRANSLATE_FACTOR_; }; -#endif //CLOUD_TRANSFORM_TOOL_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h index 258df8c7..35fd9cb7 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/command.h @@ -39,8 +39,7 @@ /// CommandQueue. /// @author Yue Li and Matthew Hielsberg -#ifndef COMMAND_H_ -#define COMMAND_H_ +#pragma once #include @@ -101,4 +100,3 @@ class Command assert(false); return (*this); } }; -#endif //COMMAND_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/commandQueue.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/commandQueue.h index 2d49090d..a0e51f14 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/commandQueue.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/commandQueue.h @@ -39,8 +39,7 @@ /// in order to both execute them and undo them in the proper order. /// @author Yue Li and Matthew Hielsberg -#ifndef COMMAND_QUEUE_H_ -#define COMMAND_QUEUE_H_ +#pragma once #include #include @@ -74,7 +73,7 @@ class CommandQueue /// @param command_ptr a shared pointer pointing to a command object whose /// execute function will be invoked by this object. void - execute (CommandPtr); + execute (const CommandPtr&); /// @brief Undoes the last command by popping the tail of the queue, invoke /// the undo function of the command. @@ -119,4 +118,3 @@ class CommandQueue /// The depth limit of the command queue. unsigned int depth_limit_; }; -#endif // COMMAND_QUEUE_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/common.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/common.h index 71851ce0..0f3b4613 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/common.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/common.h @@ -37,8 +37,7 @@ /// @details The set of simple common operations used throughout the project. /// @author Yue Li and Matthew Hielsberg -#ifndef COMMON_H_ -#define COMMON_H_ +#pragma once #include @@ -83,5 +82,3 @@ toString(T input, std::string &result) /// @param s The string to be made lower. void stringToLower(std::string &s); - -#endif // COMMON_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyBuffer.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyBuffer.h index 740e8369..9adc2cac 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyBuffer.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyBuffer.h @@ -38,8 +38,7 @@ /// copied from the cloud. /// @author Yue Li and Matthew Hielsberg -#ifndef COPY_BUFFER_H_ -#define COPY_BUFFER_H_ +#pragma once #include #include @@ -56,24 +55,6 @@ class CopyBuffer : public Statistics if (register_stats) registerStats(); } - - /// @brief Copy Constructor - /// @details create a copy buffer by copying all the internal states of the - /// passed copy buffer. - /// @param copy the copy buffer object used to initialize this object - CopyBuffer (const CopyBuffer& copy); - - /// @brief Destructor - ~CopyBuffer () - { - } - - /// @brief Equal Operator - /// @details Copy all the internal states to the this copy buffer object. - /// @param copy_buffer the copy buffer object used to update the this object - /// @return A reference to this. - CopyBuffer& - operator= (const CopyBuffer& copy_buffer); /// @brief Sets the points in the copy buffer. /// @details The passed selection pointer is used to get specified points @@ -85,7 +66,7 @@ class CopyBuffer : public Statistics /// copied /// @param selection a const reference to the selected points object void - set (ConstCloudPtr cloud_ptr, const Selection& selection); + set (const ConstCloudPtr& cloud_ptr, const Selection& selection); /// @brief Returns the points stored in the internal buffer as a const Cloud const Cloud& @@ -101,7 +82,7 @@ class CopyBuffer : public Statistics /// @brief Get the statistics of the copied points in string. std::string - getStat () const; + getStat () const override; /// @brief Returns true if the buffer is empty, false otherwise bool @@ -114,4 +95,3 @@ class CopyBuffer : public Statistics /// a cloud object holding all the copied points. Cloud buffer_; }; -#endif // COPY_BUFFER_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyCommand.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyCommand.h index 4ffc169b..d7dc85cb 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyCommand.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/copyCommand.h @@ -38,8 +38,7 @@ /// buffer with the current selection. The /// @author Yue Li and Matthew Hielsberg -#ifndef COPY_COMMAND_H_ -#define COPY_COMMAND_H_ +#pragma once #include #include @@ -55,23 +54,25 @@ class CopyCommand : public Command CopyCommand (CopyBufferPtr copy_buffer_ptr, ConstSelectionPtr selection_ptr, ConstCloudPtr cloud_ptr) - : copy_buffer_ptr_(copy_buffer_ptr), selection_ptr_(selection_ptr), - cloud_ptr_(cloud_ptr) + : copy_buffer_ptr_(std::move(copy_buffer_ptr)), selection_ptr_(std::move(selection_ptr)), + cloud_ptr_(std::move(cloud_ptr)) { has_undo_ = false; } - /// @brief Destructor - ~CopyCommand () - { - } - + /// @brief Copy constructor - commands are non-copyable + CopyCommand (const CopyCommand&) = delete; + + /// @brief Equal operator - commands are non-copyable + CopyCommand& + operator= (const CopyCommand&) = delete; + protected: /// @brief Copy the selected points into the copy buffer. /// @pre Assumes the constructor was given appropriate pointers to the /// required objects. void - execute () + execute () override { if (!cloud_ptr_) return; @@ -80,31 +81,12 @@ class CopyCommand : public Command /// @brief undo is not supported for this command. void - undo () + undo () override { assert(false); } private: - /// @brief Default constructor - object is not default constructable - CopyCommand () - { - assert(false); - } - - /// @brief Copy constructor - commands are non-copyable - CopyCommand (const CopyCommand&) - { - assert(false); - } - - /// @brief Equal operator - commands are non-copyable - CopyCommand& - operator= (const CopyCommand&) - { - assert(false); return (*this); - } - /// a pointer to the copy buffer. CopyBufferPtr copy_buffer_ptr_; @@ -114,4 +96,3 @@ class CopyCommand : public Command /// a shared pointer pointing to the cloud ConstCloudPtr cloud_ptr_; }; -#endif //COPY_COMMAND_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cutCommand.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cutCommand.h index 7c79e248..f5d28b31 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cutCommand.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/cutCommand.h @@ -38,8 +38,7 @@ /// points from the cloud and filling the copy buffer. /// @author Yue Li and Matthew Hielsberg -#ifndef CUT_COMMAND_H_ -#define CUT_COMMAND_H_ +#pragma once #include #include @@ -55,7 +54,14 @@ class CutCommand : public Command /// @param cloud_ptr a shared pointer pointing to the cloud object. CutCommand (CopyBufferPtr copy_buffer_ptr, SelectionPtr selection_ptr, - CloudPtr cloud_ptr); + const CloudPtr& cloud_ptr); + + /// @brief Copy constructor - commands are non-copyable + CutCommand (const CutCommand&) = delete; + + /// @brief Equal operator - commands are non-copyable + CutCommand& + operator= (const CutCommand&) = delete; /// @brief Destructor ~CutCommand (); @@ -66,33 +72,14 @@ class CutCommand : public Command /// @pre Assumes the constructor was given appropriate pointers to the /// required objects. void - execute (); + execute () override; /// @brief Returns the cut points to the cloud. This does not reconstruct /// the original ordering of the point cloud. void - undo (); + undo () override; private: - /// @brief Default constructor - object is not default constructable - CutCommand () : cut_selection_(CloudPtr()) - { - assert(false); - } - - /// @brief Copy constructor - commands are non-copyable - CutCommand (const CutCommand&) : cut_selection_(CloudPtr()) - { - assert(false); - } - - /// @brief Equal operator - commands are non-copyable - CutCommand& - operator= (const CutCommand&) - { - assert(false); return (*this); - } - /// A shared pointer pointing to the selection object. SelectionPtr selection_ptr_; @@ -108,7 +95,4 @@ class CutCommand : public Command /// The copy buffer which backs up the points removed from the cloud. CopyBuffer cut_cloud_buffer_; - }; - -#endif // CUT_COMMAND_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/deleteCommand.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/deleteCommand.h index e2a94a58..caebdb58 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/deleteCommand.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/deleteCommand.h @@ -38,8 +38,7 @@ /// from the cloud as well as the ability to undo the removal. /// @author Yue Li and Matthew Hielsberg -#ifndef DELETE_COMMAND_H_ -#define DELETE_COMMAND_H_ +#pragma once #include #include @@ -52,43 +51,25 @@ class DeleteCommand : public Command /// @brief Constructor /// @param selection_ptr A shared pointer pointing to the selection object. /// @param cloud_ptr A shared pointer pointing to the cloud object. - DeleteCommand (SelectionPtr selection_ptr, CloudPtr cloud_ptr); - - /// @brief Destructor - ~DeleteCommand () - { - } - + DeleteCommand (SelectionPtr selection_ptr, const CloudPtr& cloud_ptr); + + /// @brief Copy constructor - commands are non-copyable + DeleteCommand (const DeleteCommand& c) = delete; + + /// @brief Equal operator - commands are non-copyable + DeleteCommand& + operator= (const DeleteCommand&) = delete; + protected: /// @brief Removes the selected points and maintains a backup for undo. void - execute (); + execute () override; /// @brief Returns the deleted points to the cloud, Order is not preserved. void - undo (); + undo () override; private: - /// @brief Default constructor - object is not default constructable - DeleteCommand (): deleted_selection_(CloudPtr()) - { - assert(false); - } - - /// @brief Copy constructor - commands are non-copyable - DeleteCommand (const DeleteCommand& c) - : deleted_selection_(c.deleted_selection_) - { - assert(false); - } - - /// @brief Equal operator - commands are non-copyable - DeleteCommand& - operator= (const DeleteCommand&) - { - assert(false); return (*this); - } - /// a pointer pointing to the cloud CloudPtr cloud_ptr_; @@ -102,5 +83,3 @@ class DeleteCommand : public Command /// a copy buffer which backs up the points deleted from the cloud. CopyBuffer deleted_cloud_buffer_; }; - -#endif // DELETE_COMMAND_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseCommand.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseCommand.h index ea4d6bf0..b01f7cf3 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseCommand.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseCommand.h @@ -40,8 +40,7 @@ /// http://pointclouds.org/documentation/tutorials/statistical_outlier.php /// @author Yue Li and Matthew Hielsberg -#ifndef DENOISE_COMMAND_H_ -#define DENOISE_COMMAND_H_ +#pragma once #include #include @@ -56,47 +55,30 @@ public: /// @param cloud_ptr a shared pointer pointing to the cloud object. /// @param mean the number of points to use for mean distance estimation. /// @param threshold the standard deviation multiplier threshold - DenoiseCommand (SelectionPtr selection_ptr, CloudPtr cloud_ptr, + DenoiseCommand (SelectionPtr selection_ptr, const CloudPtr& cloud_ptr, float mean, float threshold) - : selection_ptr_(selection_ptr), cloud_ptr_(cloud_ptr), mean_(mean), + : selection_ptr_(std::move(selection_ptr)), cloud_ptr_(cloud_ptr), mean_(mean), threshold_(threshold), removed_indices_(cloud_ptr) { } - /// @brief Destructor - ~DenoiseCommand () - { - } + /// @brief Copy constructor - commands are non-copyable + DenoiseCommand (const DenoiseCommand&) = delete; + + /// @brief Equal operator - commands are non-copyable + DenoiseCommand& + operator= (const DenoiseCommand&) = delete; protected: /// @brief Runs the denois algorithm to remove all the outliers. void - execute (); + execute () override; /// @brief Adds the removed noisy points back to the cloud void - undo (); + undo () override; private: - /// @brief Default Constructor - DenoiseCommand () : removed_indices_(CloudPtr()) - { - } - - /// @brief Copy constructor - commands are non-copyable - DenoiseCommand (const DenoiseCommand&) - : removed_indices_(CloudPtr()) - { - assert(false); - } - - /// @brief Equal operator - commands are non-copyable - DenoiseCommand& - operator= (const DenoiseCommand&) - { - assert(false); return (*this); - } - /// A shared pointer pointing to the selection object of the widget SelectionPtr selection_ptr_; @@ -115,5 +97,3 @@ private: /// A selection object which backs up the indices of the noisy points removed. Selection removed_indices_; }; - -#endif // DENOISE_COMMAND_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h index cf069667..0f7c1fb7 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/denoiseParameterForm.h @@ -38,9 +38,7 @@ /// to PCL's denoising filter. /// @author Yue Li and Matthew Hielsberg - -#ifndef DENOISE_PARAMETER_FORM_H_ -#define DENOISE_PARAMETER_FORM_H_ +#pragma once #include #include @@ -88,11 +86,11 @@ class DenoiseParameterForm : public QDialog /// @brief Accepts and stores the current user inputs, and turns off the /// dialog box. void - accept (); + accept () override; /// @brief Rejects the current inputs, and turns off the dialog box. void - reject (); + reject () override; private: /// The line for entering the mean @@ -112,5 +110,3 @@ class DenoiseParameterForm : public QDialog /// The flag indicating whether the OK button was pressed bool ok_; }; - -#endif // DENOISE_PARAMETER_FORM_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/localTypes.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/localTypes.h index 7d0812c5..024d237c 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/localTypes.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/localTypes.h @@ -37,16 +37,14 @@ /// @details A set of useful typedefs, forward declarations and constants. /// @author Yue Li and Matthew Hielsberg +#pragma once -#ifndef LOCAL_TYPES_H_ -#define LOCAL_TYPES_H_ - -#include -#include -#include #include #include +#include +#include + // Forward declaration for commonly used objects class Command; class CommandQueue; @@ -57,54 +55,54 @@ class Cloud; // Some helpful typedef's for commonly used objects /// The type for the 3D points in the point cloud. -typedef pcl::PointXYZRGBA Point3D; +using Point3D = pcl::PointXYZRGBA; /// The type used as internal representation of a cloud object. -typedef pcl::PointCloud Cloud3D; +using Cloud3D = pcl::PointCloud; /// The type for the 3D point vector in the point cloud. -typedef pcl::PointCloud::VectorType Point3DVector; +using Point3DVector = pcl::PointCloud::VectorType; -/// The type for boost shared pointer pointing to a PCL cloud object. -typedef Cloud3D::Ptr PclCloudPtr; +/// The type for std shared pointer pointing to a PCL cloud object. +using PclCloudPtr = Cloud3D::Ptr; -/// The type for boost shared pointer pointing to a cloud object -typedef boost::shared_ptr CloudPtr; +/// The type for std shared pointer pointing to a cloud object +using CloudPtr = std::shared_ptr; -/// The type for boost shared pointer pointing to a constant cloud +/// The type for std shared pointer pointing to a constant cloud /// object -typedef boost::shared_ptr ConstCloudPtr; +using ConstCloudPtr = std::shared_ptr; -/// The type for boost shared pointer pointing to a selection buffer -typedef boost::shared_ptr SelectionPtr; +/// The type for std shared pointer pointing to a selection buffer +using SelectionPtr = std::shared_ptr; -/// The type for boost shared pointer pointing to a constant selection +/// The type for std shared pointer pointing to a constant selection /// buffer -typedef boost::shared_ptr ConstSelectionPtr; +using ConstSelectionPtr = std::shared_ptr; -/// The type for boost shared pointer pointing to a copy buffer -typedef boost::shared_ptr CopyBufferPtr; +/// The type for std shared pointer pointing to a copy buffer +using CopyBufferPtr = std::shared_ptr; -/// The type for boost shared pointer pointing to a constant copy +/// The type for std shared pointer pointing to a constant copy /// buffer -typedef boost::shared_ptr ConstCopyBufferPtr; +using ConstCopyBufferPtr = std::shared_ptr; -/// The type for boost shared pointer pointing to a command object -typedef boost::shared_ptr CommandPtr; +/// The type for std shared pointer pointing to a command object +using CommandPtr = std::shared_ptr; /// The type used for vectors holding the indices of points in a cloud -typedef std::vector IndexVector; +using IndexVector = std::vector; /// The type used for vectors holding the constant indices of points in /// a cloud -typedef std::vector ConstIndexVector; +using ConstIndexVector = std::vector; -/// The type for boost shared pointer pointing to a command queue +/// The type for std shared pointer pointing to a command queue /// object -typedef boost::shared_ptr CommandQueuePtr; +using CommandQueuePtr = std::shared_ptr; /// The type for bit masks used for recognizing key pressed by user. -typedef unsigned int BitMask; +using BitMask = unsigned int; /// ID's for the key modifiers. enum KeyModifier @@ -191,7 +189,3 @@ const float DISPLAY_Z_TRANSLATION = -2.0f; /// The radius of the trackball given as a percentage of the screen width const float TRACKBALL_RADIUS_SCALE = 0.4f; - - - -#endif // LOCAL_TYPES_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/mainWindow.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/mainWindow.h index b435d9ff..a66d6471 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/mainWindow.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/mainWindow.h @@ -40,8 +40,7 @@ /// @author Yue Li and Matthew Hielsberg /// -#ifndef MAIN_WINDOW_H_ -#define MAIN_WINDOW_H_ +#pragma once #include #include @@ -241,4 +240,3 @@ class MainWindow : public QMainWindow /// the slider used for adjusting moving speed. QSlider *move_speed_slider_; }; -#endif //MAIN_WINDOW_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/pasteCommand.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/pasteCommand.h index 5a87532c..2cc09ac2 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/pasteCommand.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/pasteCommand.h @@ -38,9 +38,7 @@ /// points in a cloud object as well as undo. /// @author Yue Li and Matthew Hielsberg - -#ifndef PASTE_COMMAND_H_ -#define PASTE_COMMAND_H_ +#pragma once #include #include @@ -56,10 +54,12 @@ class PasteCommand : public Command SelectionPtr selection_ptr, CloudPtr cloud_ptr); // comment that the selection is updated (also resets the matrix in cloud) - /// @brief Destructor - ~PasteCommand () - { - } + /// @brief Copy constructor - commands are non-copyable + PasteCommand (const PasteCommand&) = delete; + + /// @brief Equal operator - commands are non-copyable + PasteCommand& + operator= (const PasteCommand&) = delete; protected: /// @brief Appends the points in the copy buffer into the cloud. @@ -67,31 +67,13 @@ class PasteCommand : public Command /// updates the selection object to point to the newly pasted points. This /// also updates the selection object to point to the newly pasted points. void - execute (); + execute () override; /// @brief Removes the points that were pasted to the cloud. void - undo (); + undo () override; private: - /// @brief Default constructor - object is not default constructable - PasteCommand () - { - } - - /// @brief Copy constructor - commands are non-copyable - PasteCommand (const PasteCommand&) - { - assert(false); - } - - /// @brief Equal operator - commands are non-copyable - PasteCommand& - operator= (const PasteCommand&) - { - assert(false); return (*this); - } - /// a pointer pointing to the copy buffer. ConstCopyBufferPtr copy_buffer_ptr_; @@ -106,4 +88,3 @@ class PasteCommand : public Command /// support undo, one only has to resize the cloud using this value. unsigned int prev_cloud_size_; }; -#endif // PASTE_COMMAND_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select1DTool.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select1DTool.h index 8fe55354..ee06d45b 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select1DTool.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select1DTool.h @@ -37,8 +37,7 @@ /// @details Tool for selecting and deselecting individual points in the cloud. /// @author Yue Li and Matthew Hielsberg -#ifndef SELECT_1D_TOOL_H -#define SELECT_1D_TOOL_H +#pragma once #include #include @@ -59,14 +58,14 @@ class Select1DTool : public ToolInterface /// @brief Does nothing for 1D selection. /// @sa end void - start (int, int, BitMask, BitMask) + start (int, int, BitMask, BitMask) override { } /// @brief Does nothing for 1D selection. /// @sa end void - update (int, int, BitMask, BitMask) + update (int, int, BitMask, BitMask) override { } @@ -86,11 +85,11 @@ class Select1DTool : public ToolInterface /// @param buttons The state of the mouse buttons. All interaction with /// this tool requires the LEFT mouse button. All others are ignored. void - end (int x, int y, BitMask modifiers, BitMask buttons); + end (int x, int y, BitMask modifiers, BitMask buttons) override; /// @brief This function does nothing. void - draw () const + draw () const override { } @@ -107,4 +106,3 @@ class Select1DTool : public ToolInterface /// a shared pointer pointing to the cloud object CloudPtr cloud_ptr_; }; -#endif // SELECT_1D_TOOL_H diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select2DTool.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select2DTool.h index 1285375d..1adb2486 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select2DTool.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/select2DTool.h @@ -38,8 +38,7 @@ /// functionalities to enable 2D selection. /// @author Yue Li and Matthew Hielsberg -#ifndef SELECT_2D_TOOL_H_ -#define SELECT_2D_TOOL_H_ +#pragma once #include #include @@ -65,7 +64,7 @@ class Select2DTool : public ToolInterface /// modifiers: 1. shift key, 2. ctrl key, 3. no modifier is pressed. Note /// that the ctrl key may be evaluated as the command key in OSX. void - start (int x, int y, BitMask modifiers, BitMask mouseButton); + start (int x, int y, BitMask modifiers, BitMask mouseButton) override; /// @brief Update the selection tool from the current mouse screen /// coordinates and key modifiers. @@ -75,7 +74,7 @@ class Select2DTool : public ToolInterface /// @param y the y value of the mouse screen coordinates. /// @param modifiers the key modifier. void - update (int x, int y, BitMask modifiers, BitMask mouseButton); + update (int x, int y, BitMask modifiers, BitMask mouseButton) override; /// @brief Update the coordinates of the lower right corner of the rubber /// band and process the points in the rubber band. @@ -88,7 +87,7 @@ class Select2DTool : public ToolInterface /// @param y the y value of the mouse screen coordinates. /// @param modifiers the key modifier. void - end (int x, int y, BitMask modifiers, BitMask mouseButton); + end (int x, int y, BitMask modifiers, BitMask mouseButton) override; /// @brief Checks whether a point is inside the selection region. /// @param pt the point to be checked against the selection region. @@ -101,7 +100,7 @@ class Select2DTool : public ToolInterface /// @brief Draws the rubber band as well as any highlighted points during /// the 'update' phase (i.e. before the selection is made by a call to end). void - draw () const; + draw () const override; /// The default size in pixels of the rubberband tool outline static const float DEFAULT_TOOL_DISPLAY_SIZE_; @@ -149,4 +148,3 @@ class Select2DTool : public ToolInterface bool display_box_; }; -#endif // SELECT_2D_TOOL_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selection.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selection.h index baf6ad88..3e744e30 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selection.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selection.h @@ -38,9 +38,7 @@ /// point cloud that have been identifed by the selection tools. /// @author Yue Li and Matthew Hielsberg - -#ifndef SELECTION_H_ -#define SELECTION_H_ +#pragma once #include #include @@ -56,24 +54,12 @@ class Selection : public Statistics /// @param cloud_ptr A pointer to the const cloud object for which this /// object is to maintain selections. Selection (ConstCloudPtr cloud_ptr, bool register_stats=false) - : cloud_ptr_(cloud_ptr) + : cloud_ptr_(std::move(cloud_ptr)) { if (register_stats) registerStats(); } - /// @brief Copy constructor - /// @param copy The selection object to be copied - Selection (const Selection& copy) - : cloud_ptr_(copy.cloud_ptr_), selected_indices_(copy.selected_indices_) - { - } - - /// @brief Destructor. - ~Selection () - { - } - /// @brief Equal operator /// @param selection a const reference to a selection object whose /// properties will be copied. @@ -126,8 +112,8 @@ class Selection : public Statistics selected_indices_.clear(); } - typedef std::set::iterator iterator; - typedef std::set::const_iterator const_iterator; + using iterator = std::set::iterator; + using const_iterator = std::set::const_iterator; /// @brief Get the begin iterator of the selection. const_iterator @@ -143,8 +129,7 @@ class Selection : public Statistics return (selected_indices_.end()); } - typedef std::set::const_reverse_iterator - const_reverse_iterator; + using const_reverse_iterator = std::set::const_reverse_iterator; /// @brief Get the begin iterator of the selection. const_reverse_iterator @@ -188,19 +173,12 @@ class Selection : public Statistics /// @brief Get the statistics of the selected points in string. std::string - getStat () const; + getStat () const override; private: - /// @brief Default constructor - object is not default constructable - Selection () - { - } - /// a pointer to the cloud ConstCloudPtr cloud_ptr_; /// A set of unique indices that have been selected in the cloud. std::set selected_indices_; }; - -#endif // SELECTION_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selectionTransformTool.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selectionTransformTool.h index 78d7837f..a07f960b 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selectionTransformTool.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/selectionTransformTool.h @@ -37,8 +37,7 @@ /// @details This tool provides the ability to transform the current selection. /// @author Yue Li and Matthew Hielsberg -#ifndef SELECTION_TRANSFORM_TOOL_H_ -#define SELECTION_TRANSFORM_TOOL_H_ +#pragma once #include #include @@ -73,7 +72,7 @@ class SelectionTransformTool : public ToolInterface /// @param y the y value of the mouse screen coordinates. /// @param modifiers the key modifier. void - start (int x, int y, BitMask modifiers, BitMask buttons); + start (int x, int y, BitMask modifiers, BitMask buttons) override; /// @brief Updates the transform matrix of this object with mouse screen /// coordinates and key modifiers. Then the selection_matrix_ in the cloud @@ -92,7 +91,7 @@ class SelectionTransformTool : public ToolInterface /// (perpendicular to the view plane). If no modifier is pressed then the /// selection is rotated. void - update (int x, int y, BitMask modifiers, BitMask buttons); + update (int x, int y, BitMask modifiers, BitMask buttons) override; /// @brief Update the transform matrix for the selected points using the /// final position of the mouse. To finalize the transformation, we then @@ -102,11 +101,11 @@ class SelectionTransformTool : public ToolInterface /// @param y the y value of the mouse screen coordinates. /// @param modifiers the key modifier. void - end (int x, int y, BitMask modifiers, BitMask buttons); + end (int x, int y, BitMask modifiers, BitMask buttons) override; /// @brief This does not do anything. void - draw () const + draw () const override { } @@ -162,4 +161,3 @@ class SelectionTransformTool : public ToolInterface BitMask modifiers_; }; -#endif // SELECTION_TRANSFORMER_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h index 4a82d374..e1b866bb 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statistics.h @@ -38,8 +38,7 @@ /// displayed in a pop-up dialog. /// @author Yue Li and Matthew Hielsberg -#ifndef STATISTICS_H_ -#define STATISTICS_H_ +#pragma once #include #include @@ -94,5 +93,3 @@ class Statistics private: static std::vector stat_vec_; }; - -#endif // STATISTICS_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statisticsDialog.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statisticsDialog.h index 6def8ccf..eb28cfd8 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statisticsDialog.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/statisticsDialog.h @@ -38,8 +38,7 @@ /// to PCL's denoising filter. /// @author Yue Li and Matthew Hielsberg -#ifndef STATISTICS_DIALOG_H_ -#define STATISTICS_DIALOG_H_ +#pragma once #include #include @@ -57,7 +56,7 @@ class StatisticsDialog : public QDialog public: /// @brief Default Constructor - StatisticsDialog(QWidget *parent = 0); + StatisticsDialog(QWidget *parent = nullptr); /// @brief Destructor ~StatisticsDialog (); @@ -66,7 +65,7 @@ class StatisticsDialog : public QDialog void update (); private Q_SLOTS: - void accept (); + void accept () override; private: /// The button box. @@ -77,5 +76,3 @@ class StatisticsDialog : public QDialog /// A timer used for periodically update the statistics in the dialog. QTimer timer_; }; - -#endif // STATISTICS_DIALOG_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/toolInterface.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/toolInterface.h index efe4715b..f6348796 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/toolInterface.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/toolInterface.h @@ -39,8 +39,7 @@ /// Note that the CTRL key may be evaluated as the Command key in OSX. /// @author Yue Li and Matthew Hielsberg -#ifndef TOOL_INTERFACE_H_ -#define TOOL_INTERFACE_H_ +#pragma once #include @@ -120,4 +119,3 @@ class ToolInterface assert(false); return (*this); } }; -#endif // TOOL_INTERFACE_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h index a718154b..9f111760 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/trackball.h @@ -38,8 +38,7 @@ /// class has been based on /// @author Matthew Hielsberg -#ifndef TRACKBALL_H_ -#define TRACKBALL_H_ +#pragma once #include #include @@ -75,5 +74,3 @@ class TrackBall float radius_sqr_; }; // class TrackBall - -#endif // TRACKBALL_H_ diff --git a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/transformCommand.h b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/transformCommand.h index b710250a..0e2537cb 100644 --- a/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/transformCommand.h +++ b/apps/point_cloud_editor/include/pcl/apps/point_cloud_editor/transformCommand.h @@ -38,14 +38,12 @@ /// functionalities. // XXX - transformation of what? /// @author Yue Li and Matthew Hielsberg -#ifndef TRANSFORM_COMMAND_H_ -#define TRANSFORM_COMMAND_H_ +#pragma once #include #include #include - class TransformCommand : public Command { public: @@ -54,43 +52,33 @@ class TransformCommand : public Command /// @param cloud_ptr a shared pointer pointing to the cloud object. /// @param matrix a (4x4) transform matrix following OpenGL's format. /// @pre Assumes the selection_ptr is valid, non-NULL. - TransformCommand (ConstSelectionPtr selection_ptr, CloudPtr cloud_ptr, + TransformCommand (const ConstSelectionPtr& selection_ptr, CloudPtr cloud_ptr, const float* matrix, float translate_x, float translate_y, float translate_z); - - /// @brief Destructor - ~TransformCommand () - { - } + + /// @brief Copy constructor - object is not copy-constructable + TransformCommand (const TransformCommand&) = delete; + + /// @brief Equal operator - object is non-copyable + TransformCommand& + operator= (const TransformCommand&) = delete; protected: // Transforms the coorindates of the selected points according to the transform // matrix. void - execute (); + execute () override; // Restore the coordinates of the transformed points. void - undo (); + undo () override; private: - /// @brief Copy constructor - object is not copy-constructable - TransformCommand (const TransformCommand&) - { - } - - /// @brief Equal operator - object is non-copyable - TransformCommand& - operator= (const TransformCommand&) - { - assert(false); return (*this); - } - /// @brief Applies the transformation to the point values /// @param sel_ptr A pointer to the selection object whose points are to be /// transformed. void - applyTransform(ConstSelectionPtr sel_ptr); + applyTransform(const ConstSelectionPtr& sel_ptr); /// pointers to constructor params ConstSelectionPtr selection_ptr_; @@ -115,5 +103,3 @@ class TransformCommand : public Command /// The center of the cloud used by this command float cloud_center_[XYZ_SIZE]; }; - -#endif // TRANSFORM_COMMAND_H_ diff --git a/apps/point_cloud_editor/src/cloud.cpp b/apps/point_cloud_editor/src/cloud.cpp index f55d90a5..b104a542 100644 --- a/apps/point_cloud_editor/src/cloud.cpp +++ b/apps/point_cloud_editor/src/cloud.cpp @@ -98,7 +98,7 @@ Cloud::Cloud (const Cloud3D &cloud, bool register_stats) } Cloud::Cloud (const Cloud ©) - : cloud_(copy.cloud_), selection_wk_ptr_(copy.selection_wk_ptr_), + : Statistics (copy), cloud_(copy.cloud_), selection_wk_ptr_(copy.selection_wk_ptr_), use_color_ramp_(copy.use_color_ramp_), color_ramp_axis_(copy.color_ramp_axis_), display_scale_(copy.display_scale_), @@ -117,8 +117,6 @@ Cloud::Cloud (const Cloud ©) std::copy(copy.highlight_color_, copy.highlight_color_+RGB, highlight_color_); } -Cloud::~Cloud () {} - Cloud& Cloud::operator= (const Cloud &cloud) { @@ -184,7 +182,7 @@ Cloud::setSelectionTranslation (float dx, float dy, float dz) } void -Cloud::setSelection (SelectionPtr selection_ptr) +Cloud::setSelection (const SelectionPtr& selection_ptr) { selection_wk_ptr_ = selection_ptr; if (!selection_ptr || selection_ptr->empty()) @@ -193,9 +191,8 @@ Cloud::setSelection (SelectionPtr selection_ptr) partitioned_indices_.resize(cloud_.size()); std::generate(partitioned_indices_.begin(), partitioned_indices_.end(), inc); unsigned int pos = 0; - Selection::const_iterator it; // assumes selection is sorted small to large - for (it = selection_ptr->begin(); it != selection_ptr->end(); ++it, ++pos) + for (auto it = selection_ptr->begin(); it != selection_ptr->end(); ++it, ++pos) { std::swap(partitioned_indices_[pos], partitioned_indices_[*it]); } @@ -330,8 +327,7 @@ void Cloud::remove(const Selection& selection) { unsigned int pos = cloud_.size(); - Selection::const_reverse_iterator rit; - for (rit = selection.rbegin(); rit != selection.rend(); ++rit) + for (auto rit = selection.rbegin(); rit != selection.rend(); ++rit) std::swap(cloud_.points[--pos], cloud_.points[*rit]); resize(cloud_.size()-selection.size()); } @@ -420,7 +416,7 @@ Cloud::getDisplaySpacePoint (unsigned int index) const void Cloud::getDisplaySpacePoints (Point3DVector& pts) const { - for(unsigned int i = 0; i < cloud_.size(); ++i) + for(std::size_t i = 0; i < cloud_.size(); ++i) pts.push_back(getDisplaySpacePoint(i)); } @@ -442,8 +438,7 @@ Cloud::restore (const CopyBuffer& copy_buffer, const Selection& selection) append(copied_cloud); unsigned int pos = cloud_.size(); - Selection::const_reverse_iterator rit; - for (rit = selection.rbegin(); rit != selection.rend(); ++rit) + for (auto rit = selection.rbegin(); rit != selection.rend(); ++rit) std::swap(cloud_.points[--pos], cloud_.points[*rit]); } @@ -467,7 +462,7 @@ Cloud::updateCloudMembers () float *pt = &(cloud_.points[0].data[X]); std::copy(pt, pt+XYZ_SIZE, max_xyz_); std::copy(max_xyz_, max_xyz_+XYZ_SIZE, min_xyz_); - for (unsigned int i = 1; i < cloud_.size(); ++i) + for (std::size_t i = 1; i < cloud_.size(); ++i) { for (unsigned int j = 0; j < XYZ_SIZE; ++j) { diff --git a/apps/point_cloud_editor/src/cloudEditorWidget.cpp b/apps/point_cloud_editor/src/cloudEditorWidget.cpp index 505888dc..9a297d6b 100644 --- a/apps/point_cloud_editor/src/cloudEditorWidget.cpp +++ b/apps/point_cloud_editor/src/cloudEditorWidget.cpp @@ -37,7 +37,7 @@ /// @details the implementation of class CloudEditorWidget. /// @author Yue Li and Matthew Hielsberg -#include +#include #include #include #include @@ -90,7 +90,7 @@ CloudEditorWidget::~CloudEditorWidget () void CloudEditorWidget::loadFile(const std::string &filename) { - std::string ext = filename.substr(filename.find_last_of(".")+1); + std::string ext = filename.substr(filename.find_last_of('.')+1); FileLoadMap::iterator it = cloud_load_func_map_.find(ext); if (it != cloud_load_func_map_.end()) (it->second)(this, filename); @@ -132,7 +132,7 @@ CloudEditorWidget::save () QString file_path = QFileDialog::getSaveFileName(this,tr("Save point cloud")); std::string file_path_std = file_path.toStdString(); - if ( (file_path_std == "") || (!cloud_ptr_) ) + if ( (file_path_std.empty()) || (!cloud_ptr_) ) return; if (is_colored_) @@ -185,7 +185,7 @@ CloudEditorWidget::view () { if (!cloud_ptr_) return; - tool_ptr_ = boost::shared_ptr( + tool_ptr_ = std::shared_ptr( new CloudTransformTool(cloud_ptr_)); } @@ -194,7 +194,7 @@ CloudEditorWidget::select1D () { if (!cloud_ptr_) return; - tool_ptr_ = boost::shared_ptr(new Select1DTool(selection_ptr_, + tool_ptr_ = std::shared_ptr(new Select1DTool(selection_ptr_, cloud_ptr_)); update(); } @@ -204,7 +204,7 @@ CloudEditorWidget::select2D () { if (!cloud_ptr_) return; - tool_ptr_ = boost::shared_ptr(new Select2DTool(selection_ptr_, + tool_ptr_ = std::shared_ptr(new Select2DTool(selection_ptr_, cloud_ptr_)); update(); } @@ -214,7 +214,7 @@ CloudEditorWidget::select3D () { if (!cloud_ptr_) return; - //tool_ptr_ = boost::shared_ptr(new Select3DTool(selection_ptr_, + //tool_ptr_ = std::shared_ptr(new Select3DTool(selection_ptr_, // cloud_ptr_)); update(); } @@ -245,7 +245,7 @@ CloudEditorWidget::copy () return; if (!selection_ptr_ || selection_ptr_->empty()) return; - boost::shared_ptr c(new CopyCommand(copy_buffer_ptr_, + std::shared_ptr c(new CopyCommand(copy_buffer_ptr_, selection_ptr_, cloud_ptr_)); command_queue_ptr_->execute(c); } @@ -257,7 +257,7 @@ CloudEditorWidget::paste () return; if (!copy_buffer_ptr_ || copy_buffer_ptr_->empty()) return; - boost::shared_ptr c(new PasteCommand(copy_buffer_ptr_, + std::shared_ptr c(new PasteCommand(copy_buffer_ptr_, selection_ptr_, cloud_ptr_)); command_queue_ptr_->execute(c); update(); @@ -270,7 +270,7 @@ CloudEditorWidget::remove () return; if (!selection_ptr_ || selection_ptr_->empty()) return; - boost::shared_ptr c(new DeleteCommand(selection_ptr_, + std::shared_ptr c(new DeleteCommand(selection_ptr_, cloud_ptr_)); command_queue_ptr_->execute(c); update(); @@ -283,7 +283,7 @@ CloudEditorWidget::cut () return; if (!selection_ptr_ || selection_ptr_->empty()) return; - boost::shared_ptr c(new CutCommand(copy_buffer_ptr_, + std::shared_ptr c(new CutCommand(copy_buffer_ptr_, selection_ptr_, cloud_ptr_)); command_queue_ptr_->execute(c); update(); @@ -294,7 +294,7 @@ CloudEditorWidget::transform () { if (!cloud_ptr_ || !selection_ptr_ || selection_ptr_->empty()) return; - tool_ptr_ = boost::shared_ptr( + tool_ptr_ = std::shared_ptr( new SelectionTransformTool(selection_ptr_, cloud_ptr_, command_queue_ptr_)); update(); } @@ -311,7 +311,7 @@ CloudEditorWidget::denoise () { return; } - boost::shared_ptr c(new DenoiseCommand(selection_ptr_, + std::shared_ptr c(new DenoiseCommand(selection_ptr_, cloud_ptr_, form.getMeanK(), form.getStdDevThresh())); command_queue_ptr_->execute(c); update(); @@ -544,7 +544,7 @@ CloudEditorWidget::loadFilePCD(const std::string &filename) cloud_ptr_->setPointSize(point_size_); cloud_ptr_->setHighlightPointSize(selected_point_size_); tool_ptr_ = - boost::shared_ptr(new CloudTransformTool(cloud_ptr_)); + std::shared_ptr(new CloudTransformTool(cloud_ptr_)); if (isColored(filename)) { @@ -572,12 +572,12 @@ CloudEditorWidget::isColored (const std::string &fileName) const pcl::PCLPointCloud2 cloud2; pcl::PCDReader reader; reader.readHeader(fileName, cloud2); - std::vector< pcl::PCLPointField > fs = cloud2.fields; - for(unsigned int i = 0; i < fs.size(); ++i) + std::vector< pcl::PCLPointField > cloud_fields = cloud2.fields; + for(const auto &field : cloud_fields) { - std::string name(fs[i].name); + std::string name(field.name); stringToLower(name); - if ((name.compare("rgb") == 0) || (name.compare("rgba") == 0)) + if ((name == "rgb") || (name == "rgba")) return true; } return false; @@ -590,7 +590,7 @@ CloudEditorWidget::swapRBValues () return; for (unsigned int i = 0; i < cloud_ptr_ -> size(); i++) { - uint8_t cc = (*cloud_ptr_)[i].r; + std::uint8_t cc = (*cloud_ptr_)[i].r; (*cloud_ptr_)[i].r = (*cloud_ptr_)[i].b; (*cloud_ptr_)[i].b = cc; } diff --git a/apps/point_cloud_editor/src/cloudTransformTool.cpp b/apps/point_cloud_editor/src/cloudTransformTool.cpp index 2f07e4ce..e368ec3b 100644 --- a/apps/point_cloud_editor/src/cloudTransformTool.cpp +++ b/apps/point_cloud_editor/src/cloudTransformTool.cpp @@ -38,7 +38,7 @@ /// @author Yue Li and Matthew Hielsberg #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ const float CloudTransformTool::DEFAULT_TRANSLATE_FACTOR_ = 0.001f; CloudTransformTool::CloudTransformTool (CloudPtr cloud_ptr) - : cloud_ptr_(cloud_ptr), x_(0), y_(0), scale_factor_(DEFAULT_SCALE_FACTOR_), + : cloud_ptr_(std::move(cloud_ptr)), x_(0), y_(0), scale_factor_(DEFAULT_SCALE_FACTOR_), translate_factor_(DEFAULT_TRANSLATE_FACTOR_) { setIdentity(transform_matrix_); diff --git a/apps/point_cloud_editor/src/commandQueue.cpp b/apps/point_cloud_editor/src/commandQueue.cpp index ea2f931f..6699cca5 100644 --- a/apps/point_cloud_editor/src/commandQueue.cpp +++ b/apps/point_cloud_editor/src/commandQueue.cpp @@ -58,7 +58,7 @@ CommandQueue::enforceDequeLimit () } void -CommandQueue::execute (CommandPtr command_ptr) +CommandQueue::execute (const CommandPtr& command_ptr) { if (!command_ptr) return; diff --git a/apps/point_cloud_editor/src/copyBuffer.cpp b/apps/point_cloud_editor/src/copyBuffer.cpp index 60794266..2e0f921d 100644 --- a/apps/point_cloud_editor/src/copyBuffer.cpp +++ b/apps/point_cloud_editor/src/copyBuffer.cpp @@ -42,27 +42,14 @@ #include #include -CopyBuffer::CopyBuffer (const CopyBuffer& copy_buffer) : - buffer_(copy_buffer.buffer_) -{ -} - -CopyBuffer& -CopyBuffer::operator= (const CopyBuffer& copy_buffer) -{ - buffer_ = copy_buffer.buffer_; - return (*this); -} - void -CopyBuffer::set (ConstCloudPtr cloud_ptr, const Selection& selection) +CopyBuffer::set (const ConstCloudPtr& cloud_ptr, const Selection& selection) { clean(); if (!cloud_ptr) return; - Selection::const_iterator s_it; - for(s_it = selection.begin(); s_it != selection.end(); ++s_it) - buffer_.append( (*cloud_ptr)[*s_it] ); + for(const unsigned int &s_it : selection) + buffer_.append( (*cloud_ptr)[s_it] ); } const Cloud& diff --git a/apps/point_cloud_editor/src/cutCommand.cpp b/apps/point_cloud_editor/src/cutCommand.cpp index c1e60512..a184d50b 100644 --- a/apps/point_cloud_editor/src/cutCommand.cpp +++ b/apps/point_cloud_editor/src/cutCommand.cpp @@ -44,9 +44,9 @@ CutCommand::CutCommand (CopyBufferPtr copy_buffer_ptr, SelectionPtr selection_ptr, - CloudPtr cloud_ptr) - : selection_ptr_(selection_ptr), cloud_ptr_(cloud_ptr), - copy_buffer_ptr_(copy_buffer_ptr), cut_selection_(cloud_ptr) + const CloudPtr& cloud_ptr) + : selection_ptr_(std::move(selection_ptr)), cloud_ptr_(cloud_ptr), + copy_buffer_ptr_(std::move(copy_buffer_ptr)), cut_selection_(cloud_ptr) { } diff --git a/apps/point_cloud_editor/src/deleteCommand.cpp b/apps/point_cloud_editor/src/deleteCommand.cpp index 3a1dd1a7..9eb676ab 100644 --- a/apps/point_cloud_editor/src/deleteCommand.cpp +++ b/apps/point_cloud_editor/src/deleteCommand.cpp @@ -43,8 +43,8 @@ #include DeleteCommand::DeleteCommand (SelectionPtr selection_ptr, - CloudPtr cloud_ptr) - : cloud_ptr_(cloud_ptr), selection_ptr_(selection_ptr), deleted_selection_(cloud_ptr) {} + const CloudPtr& cloud_ptr) + : cloud_ptr_(cloud_ptr), selection_ptr_(std::move(selection_ptr)), deleted_selection_(cloud_ptr) {} void DeleteCommand::execute () diff --git a/apps/point_cloud_editor/src/denoiseCommand.cpp b/apps/point_cloud_editor/src/denoiseCommand.cpp index f66d2132..93a0f6d8 100644 --- a/apps/point_cloud_editor/src/denoiseCommand.cpp +++ b/apps/point_cloud_editor/src/denoiseCommand.cpp @@ -61,9 +61,8 @@ DenoiseCommand::execute () filter.filter(temp_cloud); // back up the removed indices. pcl::IndicesConstPtr indices_ptr = filter.getRemovedIndices(); - std::vector::const_iterator it; - for(it = indices_ptr->begin(); it != indices_ptr->end(); ++it) - removed_indices_.addIndex(static_cast(*it)); + for(const int &it : *indices_ptr) + removed_indices_.addIndex(static_cast(it)); // back up the removed points. removed_points_.set(cloud_ptr_, removed_indices_); // remove the noisy points. diff --git a/apps/point_cloud_editor/src/main.cpp b/apps/point_cloud_editor/src/main.cpp index ca87a3f0..190e6a31 100644 --- a/apps/point_cloud_editor/src/main.cpp +++ b/apps/point_cloud_editor/src/main.cpp @@ -60,5 +60,5 @@ main(int argc, char *argv[]) //QApplication::setWindowIcon(QIcon(":/pceditor.icns")); MainWindow main_window(argc, argv); main_window.show(); - return (app.exec()); + return (QApplication::exec()); } diff --git a/apps/point_cloud_editor/src/pasteCommand.cpp b/apps/point_cloud_editor/src/pasteCommand.cpp index ebe55f6c..47085b27 100644 --- a/apps/point_cloud_editor/src/pasteCommand.cpp +++ b/apps/point_cloud_editor/src/pasteCommand.cpp @@ -46,8 +46,8 @@ PasteCommand::PasteCommand (ConstCopyBufferPtr copy_buffer_ptr, SelectionPtr selection_ptr, CloudPtr cloud_ptr) - : copy_buffer_ptr_(copy_buffer_ptr), selection_ptr_(selection_ptr), - cloud_ptr_(cloud_ptr) + : copy_buffer_ptr_(std::move(copy_buffer_ptr)), selection_ptr_(std::move(selection_ptr)), + cloud_ptr_(std::move(cloud_ptr)) { } diff --git a/apps/point_cloud_editor/src/select1DTool.cpp b/apps/point_cloud_editor/src/select1DTool.cpp index 4221e01a..cdcf5cef 100644 --- a/apps/point_cloud_editor/src/select1DTool.cpp +++ b/apps/point_cloud_editor/src/select1DTool.cpp @@ -45,7 +45,7 @@ #include Select1DTool::Select1DTool (SelectionPtr selection_ptr, CloudPtr cloud_ptr) - : selection_ptr_(selection_ptr), cloud_ptr_(cloud_ptr) + : selection_ptr_(std::move(selection_ptr)), cloud_ptr_(std::move(cloud_ptr)) { } diff --git a/apps/point_cloud_editor/src/select2DTool.cpp b/apps/point_cloud_editor/src/select2DTool.cpp index 1bf5e052..ae30aea9 100644 --- a/apps/point_cloud_editor/src/select2DTool.cpp +++ b/apps/point_cloud_editor/src/select2DTool.cpp @@ -49,7 +49,7 @@ const float Select2DTool::DEFAULT_TOOL_DISPLAY_COLOR_BLUE_ = 1.0f; Select2DTool::Select2DTool (SelectionPtr selection_ptr, CloudPtr cloud_ptr) - : selection_ptr_(selection_ptr), cloud_ptr_(cloud_ptr), display_box_(false) + : selection_ptr_(std::move(selection_ptr)), cloud_ptr_(std::move(cloud_ptr)), display_box_(false) { } @@ -96,7 +96,7 @@ Select2DTool::end (int x, int y, BitMask modifiers, BitMask) Point3DVector ptsvec; cloud_ptr_->getDisplaySpacePoints(ptsvec); - for(unsigned int i = 0; i < ptsvec.size(); ++i) + for(std::size_t i = 0; i < ptsvec.size(); ++i) { Point3D pt = ptsvec[i]; if (isInSelectBox(pt, project, viewport)) @@ -196,8 +196,8 @@ Select2DTool::drawRubberBand (GLint* viewport) const void Select2DTool::highlightPoints (GLint* viewport) const { - double width = abs(origin_x_ - final_x_); - double height = abs(origin_y_ - final_y_); + double width = std::abs(origin_x_ - final_x_); + double height = std::abs(origin_y_ - final_y_); glPushAttrib(GL_SCISSOR_BIT); { glEnable(GL_SCISSOR_TEST); diff --git a/apps/point_cloud_editor/src/selection.cpp b/apps/point_cloud_editor/src/selection.cpp index b9a10952..b91ecb63 100644 --- a/apps/point_cloud_editor/src/selection.cpp +++ b/apps/point_cloud_editor/src/selection.cpp @@ -72,9 +72,8 @@ Selection::addIndex (const IndexVector &indices) void Selection::removeIndex (const IndexVector &indices) { - IndexVector::const_iterator it; - for(it = indices.begin(); it != indices.end(); ++it) - removeIndex(*it); + for(const unsigned int &index : indices) + removeIndex(index); } void @@ -118,7 +117,7 @@ Selection::invertSelect () std::string Selection::getStat () const { - if (selected_indices_.size() == 0) + if (selected_indices_.empty ()) return (""); std::string title = "Total number of selected points: "; std::string num_str; diff --git a/apps/point_cloud_editor/src/selectionTransformTool.cpp b/apps/point_cloud_editor/src/selectionTransformTool.cpp index b299d8cc..aa23621f 100644 --- a/apps/point_cloud_editor/src/selectionTransformTool.cpp +++ b/apps/point_cloud_editor/src/selectionTransformTool.cpp @@ -37,7 +37,7 @@ /// @details the implementation of class CloudTransformTool /// @author Yue Li and Matthew Hielsberg -#include +#include #include #include #include @@ -50,9 +50,9 @@ const float SelectionTransformTool::DEFAULT_TRANSLATE_FACTOR_ = 0.001; SelectionTransformTool::SelectionTransformTool (ConstSelectionPtr selection_ptr, CloudPtr cloud_ptr, CommandQueuePtr command_queue_ptr) - : selection_ptr_(selection_ptr), - cloud_ptr_(cloud_ptr), - command_queue_ptr_(command_queue_ptr), + : selection_ptr_(std::move(selection_ptr)), + cloud_ptr_(std::move(cloud_ptr)), + command_queue_ptr_(std::move(command_queue_ptr)), translate_factor_(DEFAULT_TRANSLATE_FACTOR_) { std::fill_n(center_xyz_, XYZ_SIZE, 0); @@ -97,7 +97,7 @@ SelectionTransformTool::update (int x, int y, BitMask, BitMask buttons) 0.0f); return; } - else if (modifiers_ & ALT) + if (modifiers_ & ALT) { // selection motion is not applied directly (waits for end) // as such we can not update x and y immediately @@ -134,21 +134,21 @@ SelectionTransformTool::end (int x, int y, BitMask modifiers, BitMask buttons) update(x, y, modifiers, buttons); if (modifiers_ & CTRL) { - boost::shared_ptr c(new TransformCommand(selection_ptr_, + std::shared_ptr c(new TransformCommand(selection_ptr_, cloud_ptr_, transform_matrix_, (float) dx * translate_factor_ * scale, (float) -dy * translate_factor_ * scale, 0.0f)); command_queue_ptr_->execute(c); } else if (modifiers_ & ALT) { - boost::shared_ptr c(new TransformCommand(selection_ptr_, + std::shared_ptr c(new TransformCommand(selection_ptr_, cloud_ptr_, transform_matrix_, 0.0f, 0.0f, (float) dy * translate_factor_ * scale)); command_queue_ptr_->execute(c); } else { - boost::shared_ptr c(new TransformCommand(selection_ptr_, + std::shared_ptr c(new TransformCommand(selection_ptr_, cloud_ptr_, transform_matrix_, 0.0f, 0.0f, 0.0f)); command_queue_ptr_->execute(c); } diff --git a/apps/point_cloud_editor/src/statistics.cpp b/apps/point_cloud_editor/src/statistics.cpp index 60e23ad4..506aac08 100644 --- a/apps/point_cloud_editor/src/statistics.cpp +++ b/apps/point_cloud_editor/src/statistics.cpp @@ -44,18 +44,17 @@ std::vector Statistics::stat_vec_; std::string Statistics::getStats() { - std::string result = ""; - std::vector::const_iterator stat_vec_it; - for(stat_vec_it = stat_vec_.begin(); stat_vec_it != stat_vec_.end(); ++stat_vec_it) + std::string result; + for(const auto &stat_vec : stat_vec_) { - std::string stat_string = (*stat_vec_it) -> getStat(); - if (stat_string != "") + std::string stat_string = stat_vec -> getStat(); + if (!stat_string.empty()) { - result += (stat_string + "\n"); + result += (stat_string + '\n'); } } - if (result == "") + if (result.empty()) return ("Please load your cloud."); return (result); } diff --git a/apps/point_cloud_editor/src/trackball.cpp b/apps/point_cloud_editor/src/trackball.cpp index 5c9fc852..2102fcc5 100644 --- a/apps/point_cloud_editor/src/trackball.cpp +++ b/apps/point_cloud_editor/src/trackball.cpp @@ -165,7 +165,7 @@ TrackBall::update(int s_x, int s_y) normalize(cross_x, cross_y, cross_z, nc_x, nc_y, nc_z); quat_ = quaternionFromAngleAxis(angle, nc_x, nc_y, nc_z); - if (quat_.R_component_1() != quat_.R_component_1()) + if (std::isnan(quat_.R_component_1())) quat_ = boost::math::quaternion(1.0f); origin_x_ = cur_x; diff --git a/apps/point_cloud_editor/src/transformCommand.cpp b/apps/point_cloud_editor/src/transformCommand.cpp index d595fa5a..3143825d 100644 --- a/apps/point_cloud_editor/src/transformCommand.cpp +++ b/apps/point_cloud_editor/src/transformCommand.cpp @@ -42,13 +42,13 @@ #include #include -TransformCommand::TransformCommand(ConstSelectionPtr selection_ptr, +TransformCommand::TransformCommand(const ConstSelectionPtr& selection_ptr, CloudPtr cloud_ptr, const float *matrix, float translate_x, float translate_y, float translate_z) - : selection_ptr_(selection_ptr), cloud_ptr_(cloud_ptr), + : selection_ptr_(selection_ptr), cloud_ptr_(std::move(cloud_ptr)), translate_x_(translate_x), translate_y_(translate_y), translate_z_(translate_z) { @@ -76,18 +76,14 @@ TransformCommand::undo() return; float transform_matrix_inv[MATRIX_SIZE]; invertMatrix(transform_matrix_, transform_matrix_inv); - float x,y,z; - unsigned int index = 0; - Selection::const_iterator it; - for(it = internal_selection_ptr_ -> begin(); - it != internal_selection_ptr_-> end(); ++it) + for(const unsigned int &index : *internal_selection_ptr_) { Point3D pt; - index = *it; pt.x = (*cloud_ptr_)[index].x - cloud_center_[X]; pt.y = (*cloud_ptr_)[index].y - cloud_center_[Y]; pt.z = (*cloud_ptr_)[index].z - cloud_center_[Z]; + float x,y,z; x = pt.x * cloud_matrix_[0] + pt.y * cloud_matrix_[4] + pt.z * cloud_matrix_[8] + cloud_matrix_[12]; @@ -129,16 +125,14 @@ TransformCommand::undo() } void -TransformCommand::applyTransform(ConstSelectionPtr sel_ptr) +TransformCommand::applyTransform(const ConstSelectionPtr& sel_ptr) { - float x,y,z; - unsigned int index = 0; // now modify the selected points' coordinates - Selection::const_iterator it; - for(it = sel_ptr -> begin(); it != sel_ptr-> end(); ++it) + for(const unsigned int &index : *sel_ptr) { - index = *it; Point3D pt = cloud_ptr_->getObjectSpacePoint(index); + + float x,y,z; x = pt.x * transform_matrix_[0] + pt.y * transform_matrix_[4] + pt.z * transform_matrix_[8] + transform_matrix_[12]; diff --git a/apps/src/convolve.cpp b/apps/src/convolve.cpp index 050a206b..12b22031 100644 --- a/apps/src/convolve.cpp +++ b/apps/src/convolve.cpp @@ -71,7 +71,7 @@ main (int argc, char ** argv) Eigen::ArrayXf gaussian_kernel(5); gaussian_kernel << 1.f/16, 1.f/4, 3.f/8, 1.f/4, 1.f/16; pcl::console::print_info ("convolution kernel:"); - for (int i = 0; i < gaussian_kernel.size (); ++i) + for (Eigen::Index i = 0; i < gaussian_kernel.size (); ++i) pcl::console::print_info (" %f", gaussian_kernel[i]); pcl::console::print_info ("\n"); @@ -208,7 +208,7 @@ main (int argc, char ** argv) #endif convolved_label << "threads: " << nb_threads; // Display - boost::shared_ptr viewer (new pcl::visualization::PCLVisualizer ("Convolution")); + pcl::visualization::PCLVisualizer::Ptr viewer (new pcl::visualization::PCLVisualizer ("Convolution")); // viewport stuff viewer->createViewPort (0, 0, 0.5, 1, viewport_source); viewer->createViewPort (0.5, 0, 1, 1, viewport_convolved); diff --git a/apps/src/dinast_grabber_example.cpp b/apps/src/dinast_grabber_example.cpp index a4fc93fc..1f752c41 100644 --- a/apps/src/dinast_grabber_example.cpp +++ b/apps/src/dinast_grabber_example.cpp @@ -35,18 +35,22 @@ * */ +#include + #include #include #include #include +using namespace std::chrono_literals; + template class DinastProcessor { public: - typedef pcl::PointCloud Cloud; - typedef typename Cloud::ConstPtr CloudConstPtr; + using Cloud = pcl::PointCloud; + using CloudConstPtr = typename Cloud::ConstPtr; DinastProcessor(pcl::Grabber& grabber) : interface(grabber), viewer("Dinast Cloud Viewer") {} @@ -69,17 +73,16 @@ class DinastProcessor int run () { - - boost::function f = - boost::bind (&DinastProcessor::cloud_cb_, this, _1); - + + std::function f = [this] (const CloudConstPtr& cloud) { cloud_cb_ (cloud); }; + boost::signals2::connection c = interface.registerCallback (f); interface.start (); while (!viewer.wasStopped()) { - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } interface.stop (); diff --git a/apps/src/dominant_plane_segmentation.cpp b/apps/src/dominant_plane_segmentation.cpp index 583839d7..d29cf843 100644 --- a/apps/src/dominant_plane_segmentation.cpp +++ b/apps/src/dominant_plane_segmentation.cpp @@ -33,13 +33,15 @@ * */ -#include -#include #include -#include +#ifndef PCL_NO_PRECOMPILE +#include +#include +#include #ifdef PCL_ONLY_CORE_POINT_TYPES PCL_INSTANTIATE(DominantPlaneSegmentation, (pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGBA)(pcl::PointXYZRGB)) #else PCL_INSTANTIATE(DominantPlaneSegmentation, PCL_XYZ_POINT_TYPES) -#endif +#endif // PCL_ONLY_CORE_POINT_TYPES +#endif // PCL_NO_PRECOMPILE diff --git a/apps/src/face_detection/face_trainer.cpp b/apps/src/face_detection/face_trainer.cpp index bf859700..8e18eaff 100644 --- a/apps/src/face_detection/face_trainer.cpp +++ b/apps/src/face_detection/face_trainer.cpp @@ -13,7 +13,7 @@ int main(int argc, char ** argv) int ntrees = 10; std::string forest_fn = "forest.txt"; int n_features = 1000; - std::string directory = ""; + std::string directory; int use_normals = 0; int num_images = 3000; diff --git a/apps/src/face_detection/filesystem_face_detection.cpp b/apps/src/face_detection/filesystem_face_detection.cpp index e7aaccb8..2b023fd2 100644 --- a/apps/src/face_detection/filesystem_face_detection.cpp +++ b/apps/src/face_detection/filesystem_face_detection.cpp @@ -34,7 +34,7 @@ void run(pcl::RFFaceDetectorTrainer & fdrf, typename pcl::PointCloud:: fdrf.detectFaces (); - typedef typename pcl::traits::fieldList::type FieldListM; + using FieldListM = typename pcl::traits::fieldList::type; float rgb_m; bool exists_m; @@ -205,7 +205,7 @@ int main(int argc, char ** argv) fb.open (forest_fn.c_str (), std::ios::in); std::istream os (&fb); - typedef pcl::face_detection::RFTreeNode NodeType; + using NodeType = pcl::face_detection::RFTreeNode; pcl::DecisionForest forest; forest.deserialize (os); fb.close (); @@ -214,10 +214,10 @@ int main(int argc, char ** argv) pcl::visualization::PCLVisualizer vis ("PCL Face detection"); - if (test_directory.compare ("") != 0) + if (!test_directory.empty()) { //recognize all files in directory... - std::string start = ""; + std::string start; std::string ext = std::string ("pcd"); bf::path dir = test_directory; @@ -226,11 +226,9 @@ int main(int argc, char ** argv) std::sort (files.begin (), files.end (), face_detection_apps_utils::sortFiles); - for (size_t i = 0; i < files.size (); i++) + for (const auto &filename : files) { - std::stringstream file_to_process; - file_to_process << test_directory << "/" << files[i]; - std::string file = file_to_process.str (); + std::string file = test_directory + '/' + filename; std::cout << file << std::endl; if (rgb_exists) diff --git a/apps/src/face_detection/openni_face_detection.cpp b/apps/src/face_detection/openni_face_detection.cpp index aea92209..8bb8cc57 100644 --- a/apps/src/face_detection/openni_face_detection.cpp +++ b/apps/src/face_detection/openni_face_detection.cpp @@ -21,8 +21,10 @@ void run(pcl::RFFaceDetectorTrainer & fdrf, bool heat_map = false, bool show_vot vis.addCoordinateSystem (0.1, "global"); //keyboard callback to stop getting frames and finalize application - boost::function keyboard_cb = boost::bind (&OpenNIFrameSource::OpenNIFrameSource::onKeyboardEvent, &camera, - _1); + std::function keyboard_cb = [&] (const pcl::visualization::KeyboardEvent& event) + { + camera.onKeyboardEvent (event); + }; vis.registerKeyboardCallback (keyboard_cb); while (camera.isActive ()) @@ -128,7 +130,7 @@ int main(int argc, char ** argv) fb.open (forest_fn.c_str (), std::ios::in); std::istream os (&fb); - typedef pcl::face_detection::RFTreeNode NodeType; + using NodeType = pcl::face_detection::RFTreeNode; pcl::DecisionForest forest; forest.deserialize (os); fb.close (); diff --git a/apps/src/face_detection/openni_frame_source.cpp b/apps/src/face_detection/openni_frame_source.cpp index cd112b97..1cfb7ae8 100644 --- a/apps/src/face_detection/openni_frame_source.cpp +++ b/apps/src/face_detection/openni_frame_source.cpp @@ -1,15 +1,14 @@ #include "pcl/apps/face_detection/openni_frame_source.h" #include -#include -#include +#include namespace OpenNIFrameSource { OpenNIFrameSource::OpenNIFrameSource(const std::string& device_id) : - grabber_ (device_id), most_recent_frame_ (), frame_counter_ (0), active_ (true) + grabber_ (device_id), frame_counter_ (0), active_ (true) { - boost::function frame_cb = boost::bind (&OpenNIFrameSource::onNewFrame, this, _1); + std::function frame_cb = [this] (const PointCloudConstPtr& cloud) { onNewFrame (cloud); }; grabber_.registerCallback (frame_cb); grabber_.start (); } @@ -34,7 +33,7 @@ namespace OpenNIFrameSource { mutex_.lock (); ++frame_counter_; - most_recent_frame_ = boost::make_shared < PointCloud > (*cloud); // Make a copy of the frame + most_recent_frame_ = pcl::make_shared (*cloud); // Make a copy of the frame mutex_.unlock (); } diff --git a/apps/src/feature_matching.cpp b/apps/src/feature_matching.cpp index a7c82494..db2eb1c5 100644 --- a/apps/src/feature_matching.cpp +++ b/apps/src/feature_matching.cpp @@ -17,8 +17,6 @@ #include #include #include -#include -#include #include #include #include @@ -31,11 +29,11 @@ template class ICCVTutorial { public: - ICCVTutorial (boost::shared_ptr > keypoint_detector, + ICCVTutorial (pcl::Keypoint::Ptr keypoint_detector, typename pcl::Feature::Ptr feature_extractor, - boost::shared_ptr > surface_reconstructor, - typename pcl::PointCloud::ConstPtr source, - typename pcl::PointCloud::ConstPtr target); + pcl::PCLSurfaceBase::Ptr surface_reconstructor, + pcl::PointCloud::ConstPtr source, + pcl::PointCloud::ConstPtr target); /** * @brief starts the event loop for the visualizer @@ -47,14 +45,14 @@ class ICCVTutorial * @param input the input point cloud * @param segmented the resulting segmented point cloud containing only points of the largest cluster */ - void segmentation (typename pcl::PointCloud::ConstPtr input, typename pcl::PointCloud::Ptr segmented) const; + void segmentation (const typename pcl::PointCloud::ConstPtr& input, const typename pcl::PointCloud::Ptr& segmented) const; /** * @brief Detects key points in the input point cloud * @param input the input point cloud * @param keypoints the resulting key points. Note that they are not necessarily a subset of the input cloud */ - void detectKeypoints (typename pcl::PointCloud::ConstPtr input, pcl::PointCloud::Ptr keypoints) const; + void detectKeypoints (const typename pcl::PointCloud::ConstPtr& input, const pcl::PointCloud::Ptr& keypoints) const; /** * @brief extract descriptors for given key points @@ -62,7 +60,7 @@ class ICCVTutorial * @param keypoints locations where descriptors are to be extracted * @param features resulting descriptors */ - void extractDescriptors (typename pcl::PointCloud::ConstPtr input, typename pcl::PointCloud::Ptr keypoints, typename pcl::PointCloud::Ptr features); + void extractDescriptors (typename pcl::PointCloud::ConstPtr input, const typename pcl::PointCloud::Ptr& keypoints, typename pcl::PointCloud::Ptr features); /** * @brief find corresponding features based on some metric @@ -103,9 +101,9 @@ class ICCVTutorial pcl::visualization::PCLVisualizer visualizer_; pcl::PointCloud::Ptr source_keypoints_; pcl::PointCloud::Ptr target_keypoints_; - boost::shared_ptr > keypoint_detector_; + pcl::Keypoint::Ptr keypoint_detector_; typename pcl::Feature::Ptr feature_extractor_; - boost::shared_ptr > surface_reconstructor_; + pcl::PCLSurfaceBase::Ptr surface_reconstructor_; typename pcl::PointCloud::ConstPtr source_; typename pcl::PointCloud::ConstPtr target_; typename pcl::PointCloud::Ptr source_segmented_; @@ -126,18 +124,18 @@ class ICCVTutorial }; template -ICCVTutorial::ICCVTutorial(boost::shared_ptr >keypoint_detector, +ICCVTutorial::ICCVTutorial(pcl::Keypoint::Ptr keypoint_detector, typename pcl::Feature::Ptr feature_extractor, - boost::shared_ptr > surface_reconstructor, - typename pcl::PointCloud::ConstPtr source, - typename pcl::PointCloud::ConstPtr target) + pcl::PCLSurfaceBase::Ptr surface_reconstructor, + pcl::PointCloud::ConstPtr source, + pcl::PointCloud::ConstPtr target) : source_keypoints_ (new pcl::PointCloud ()) , target_keypoints_ (new pcl::PointCloud ()) -, keypoint_detector_ (keypoint_detector) +, keypoint_detector_ (std::move(keypoint_detector)) , feature_extractor_ (feature_extractor) -, surface_reconstructor_ (surface_reconstructor) -, source_ (source) -, target_ (target) +, surface_reconstructor_ (std::move(surface_reconstructor)) +, source_ (std::move(source)) +, target_ (std::move(target)) , source_segmented_ (new pcl::PointCloud) , target_segmented_ (new pcl::PointCloud) , source_transformed_ (new pcl::PointCloud) @@ -149,7 +147,7 @@ ICCVTutorial::ICCVTutorial(boost::shared_ptr::ICCVTutorial(boost::shared_ptr -void ICCVTutorial::segmentation (typename pcl::PointCloud::ConstPtr source, typename pcl::PointCloud::Ptr segmented) const +void ICCVTutorial::segmentation (const typename pcl::PointCloud::ConstPtr& source, const typename pcl::PointCloud::Ptr& segmented) const { - cout << "segmentation..." << std::flush; + std::cout << "segmentation..." << std::flush; // fit plane and keep points above that plane pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients); pcl::PointIndices::Ptr inliers (new pcl::PointIndices); @@ -198,9 +196,9 @@ void ICCVTutorial::segmentation (typename pcl::PointCloud indices; pcl::removeNaNFromPointCloud(*segmented, *segmented, indices); - cout << "OK" << endl; + std::cout << "OK" << std::endl; - cout << "clustering..." << std::flush; + std::cout << "clustering..." << std::flush; // euclidean clustering typename pcl::search::KdTree::Ptr tree (new pcl::search::KdTree); tree->setInputCloud (segmented); @@ -214,12 +212,12 @@ void ICCVTutorial::segmentation (typename pcl::PointCloud 0)//use largest cluster + if (!cluster_indices.empty ())//use largest cluster { - cout << cluster_indices.size() << " clusters found"; + std::cout << cluster_indices.size() << " clusters found"; if (cluster_indices.size() > 1) - cout <<" Using largest one..."; - cout << endl; + std::cout <<" Using largest one..."; + std::cout << std::endl; typename pcl::IndicesPtr indices (new std::vector); *indices = cluster_indices[0].indices; extract.setInputCloud (segmented); @@ -231,16 +229,16 @@ void ICCVTutorial::segmentation (typename pcl::PointCloud -void ICCVTutorial::detectKeypoints (typename pcl::PointCloud::ConstPtr input, pcl::PointCloud::Ptr keypoints) const +void ICCVTutorial::detectKeypoints (const typename pcl::PointCloud::ConstPtr& input, const pcl::PointCloud::Ptr& keypoints) const { - cout << "keypoint detection..." << std::flush; + std::cout << "keypoint detection..." << std::flush; keypoint_detector_->setInputCloud(input); keypoint_detector_->compute(*keypoints); - cout << "OK. keypoints found: " << keypoints->points.size() << endl; + std::cout << "OK. keypoints found: " << keypoints->points.size() << std::endl; } template -void ICCVTutorial::extractDescriptors (typename pcl::PointCloud::ConstPtr input, typename pcl::PointCloud::Ptr keypoints, typename pcl::PointCloud::Ptr features) +void ICCVTutorial::extractDescriptors (typename pcl::PointCloud::ConstPtr input, const typename pcl::PointCloud::Ptr& keypoints, typename pcl::PointCloud::Ptr features) { typename pcl::PointCloud::Ptr kpts(new pcl::PointCloud); kpts->points.resize(keypoints->points.size()); @@ -255,7 +253,7 @@ void ICCVTutorial::extractDescriptors (typename pcl::PointCloud > (feature_extractor_)) { - cout << "normal estimation..." << std::flush; + std::cout << "normal estimation..." << std::flush; typename pcl::PointCloud::Ptr normals (new pcl::PointCloud); pcl::NormalEstimation normal_estimation; normal_estimation.setSearchMethod (pcl::search::Search::Ptr (new pcl::search::KdTree)); @@ -263,18 +261,18 @@ void ICCVTutorial::extractDescriptors (typename pcl::PointCloudsetInputNormals(normals); - cout << "OK" << endl; + std::cout << "OK" << std::endl; } - cout << "descriptor extraction..." << std::flush; + std::cout << "descriptor extraction..." << std::flush; feature_extractor_->compute (*features); - cout << "OK" << endl; + std::cout << "OK" << std::endl; } template void ICCVTutorial::findCorrespondences (typename pcl::PointCloud::Ptr source, typename pcl::PointCloud::Ptr target, std::vector& correspondences) const { - cout << "correspondence assignment..." << std::flush; + std::cout << "correspondence assignment..." << std::flush; correspondences.resize (source->size()); // Use a KdTree to search for the nearest matches in feature space @@ -290,20 +288,20 @@ void ICCVTutorial::findCorrespondences (typename pcl::PointCloud void ICCVTutorial::filterCorrespondences () { - cout << "correspondence rejection..." << std::flush; + std::cout << "correspondence rejection..." << std::flush; std::vector > correspondences; - for (unsigned cIdx = 0; cIdx < source2target_.size (); ++cIdx) + for (std::size_t cIdx = 0; cIdx < source2target_.size (); ++cIdx) if (target2source_[source2target_[cIdx]] == static_cast (cIdx)) correspondences.push_back(std::make_pair(cIdx, source2target_[cIdx])); correspondences_->resize (correspondences.size()); - for (unsigned cIdx = 0; cIdx < correspondences.size(); ++cIdx) + for (std::size_t cIdx = 0; cIdx < correspondences.size(); ++cIdx) { (*correspondences_)[cIdx].index_query = correspondences[cIdx].first; (*correspondences_)[cIdx].index_match = correspondences[cIdx].second; @@ -314,25 +312,25 @@ void ICCVTutorial::filterCorrespondences () rejector.setInputTarget (target_keypoints_); rejector.setInputCorrespondences(correspondences_); rejector.getCorrespondences(*correspondences_); - cout << "OK" << endl; + std::cout << "OK" << std::endl; } template void ICCVTutorial::determineInitialTransformation () { - cout << "initial alignment..." << std::flush; + std::cout << "initial alignment..." << std::flush; pcl::registration::TransformationEstimation::Ptr transformation_estimation (new pcl::registration::TransformationEstimationSVD); transformation_estimation->estimateRigidTransformation (*source_keypoints_, *target_keypoints_, *correspondences_, initial_transformation_matrix_); pcl::transformPointCloud(*source_segmented_, *source_transformed_, initial_transformation_matrix_); - cout << "OK" << endl; + std::cout << "OK" << std::endl; } template void ICCVTutorial::determineFinalTransformation () { - cout << "final registration..." << std::flush; + std::cout << "final registration..." << std::flush; pcl::Registration::Ptr registration (new pcl::IterativeClosestPoint); registration->setInputSource (source_transformed_); //registration->setInputSource (source_segmented_); @@ -343,13 +341,13 @@ void ICCVTutorial::determineFinalTransformation () registration->setMaximumIterations (1000); registration->align(*source_registered_); transformation_matrix_ = registration->getFinalTransformation(); - cout << "OK" << endl; + std::cout << "OK" << std::endl; } template void ICCVTutorial::reconstructSurface () { - cout << "surface reconstruction..." << std::flush; + std::cout << "surface reconstruction..." << std::flush; // merge the transformed and the target point cloud pcl::PointCloud::Ptr merged (new pcl::PointCloud); *merged = *source_registered_; @@ -377,7 +375,7 @@ void ICCVTutorial::reconstructSurface () surface_reconstructor_->setSearchMethod(tree); surface_reconstructor_->setInputCloud(vertices); surface_reconstructor_->reconstruct(surface_); - cout << "OK" << endl; + std::cout << "OK" << std::endl; } template @@ -532,7 +530,7 @@ main (int argc, char ** argv) int descriptor_type = atoi (argv[4]); int surface_type = atoi (argv[5]); - boost::shared_ptr > keypoint_detector; + pcl::Keypoint::Ptr keypoint_detector; if (keypoint_type == 1) { @@ -577,7 +575,7 @@ main (int argc, char ** argv) } - boost::shared_ptr > surface_reconstruction; + pcl::PCLSurfaceBase::Ptr surface_reconstruction; if (surface_type == 1) { diff --git a/apps/src/grabcut_2d.cpp b/apps/src/grabcut_2d.cpp index 67bbe82e..9db1fabe 100644 --- a/apps/src/grabcut_2d.cpp +++ b/apps/src/grabcut_2d.cpp @@ -32,10 +32,10 @@ class GrabCutHelper : public pcl::GrabCut using pcl::GrabCut::input_; public: - typedef boost::shared_ptr Ptr; - typedef boost::shared_ptr ConstPtr; + using Ptr = std::shared_ptr; + using ConstPtr = std::shared_ptr; - GrabCutHelper (uint32_t K = 5, float lambda = 50.f) + GrabCutHelper (std::uint32_t K = 5, float lambda = 50.f) : pcl::GrabCut (K, lambda) {} @@ -43,7 +43,7 @@ class GrabCutHelper : public pcl::GrabCut { } void - setInputCloud (const pcl::PointCloud::ConstPtr& cloud); + setInputCloud (const pcl::PointCloud::ConstPtr& cloud) override; void setBackgroundPointsIndices (const pcl::PointIndices::ConstPtr& point_indices); void @@ -51,11 +51,11 @@ class GrabCutHelper : public pcl::GrabCut void setTrimap(int x1, int y1, int x2, int y2, const pcl::segmentation::grabcut::TrimapValue& t); void - refine (); + refine () override; int - refineOnce (); + refineOnce () override; void - fitGMMs (); + fitGMMs () override; void display (int display_type); void @@ -138,7 +138,6 @@ GrabCutHelper::setTrimap(int x1, int y1, int x2, int y2, const pcl::segmentation void GrabCutHelper::refine () { -// boost::lock_guard lock (refine_mutex); pcl::GrabCut::refine (); buildImages (); } @@ -147,7 +146,6 @@ GrabCutHelper::refine () int GrabCutHelper::refineOnce () { - // boost::lock_guard lock (refine_once_mutex); int result = pcl::GrabCut::refineOnce (); buildImages (); return (result); @@ -157,7 +155,6 @@ GrabCutHelper::refineOnce () void GrabCutHelper::fitGMMs () { -// boost::lock_guard lock (fit_gmms_mutex); pcl::GrabCut::fitGMMs (); buildImages (); } @@ -267,7 +264,7 @@ int xstart, ystart, xend, yend; bool box = false; bool left = false, right = false; bool refining_ = false; -uint32_t width, height; +std::uint32_t width, height; GrabCutHelper grabcut; pcl::segmentation::grabcut::Image::Ptr display_image; @@ -317,7 +314,7 @@ idle_callback () if (!changed) { refining_ = false; - glutIdleFunc (NULL); + glutIdleFunc (nullptr); } } @@ -327,7 +324,7 @@ motion_callback (int x, int y) { y = height - y; - if (box == true) + if (box) { xend = x; yend = y; glutPostRedisplay (); @@ -452,7 +449,7 @@ keyboard_callback (unsigned char key, int, int) break; case 27: refining_ = false; - glutIdleFunc(NULL); + glutIdleFunc(nullptr); default: break; } @@ -471,12 +468,6 @@ int main (int argc, char** argv) return (-1); } - std::string object_file = "object.pcd", background_file = "background.pcd"; - if (parsed_file_indices.size () >= 3) - background_file = argv[parsed_file_indices[2]]; - if (parsed_file_indices.size () >= 2) - object_file = argv[parsed_file_indices[1]]; - pcl::PCDReader reader; // Test the header pcl::PCLPointCloud2 dummy; @@ -521,7 +512,7 @@ int main (int argc, char** argv) if (scene->isOrganized ()) { - pcl::uint32_t height_1 = scene->height -1; + std::uint32_t height_1 = scene->height -1; for (std::size_t i = 0; i < scene->height; ++i) { for (std::size_t j = 0; j < scene->width; ++j) diff --git a/apps/src/manual_registration/manual_registration.cpp b/apps/src/manual_registration/manual_registration.cpp index f76f075c..899e597c 100644 --- a/apps/src/manual_registration/manual_registration.cpp +++ b/apps/src/manual_registration/manual_registration.cpp @@ -291,5 +291,5 @@ main (int argc, char** argv) man_reg.show(); - return (app.exec()); + return (QApplication::exec()); } diff --git a/apps/src/multiscale_feature_persistence_example.cpp b/apps/src/multiscale_feature_persistence_example.cpp index 49f6a745..b5044583 100644 --- a/apps/src/multiscale_feature_persistence_example.cpp +++ b/apps/src/multiscale_feature_persistence_example.cpp @@ -43,6 +43,7 @@ #include #include +#include using namespace pcl; @@ -108,7 +109,7 @@ main (int argc, char **argv) feature_persistence.setDistanceMetric (pcl::CS); PointCloud::Ptr output_features (new PointCloud ()); - boost::shared_ptr > output_indices (new std::vector ()); + auto output_indices = pcl::make_shared> (); feature_persistence.determinePersistentFeatures (*output_features, output_indices); PCL_INFO ("persistent features cloud size: %u\n", output_features->points.size ()); diff --git a/apps/src/ni_agast.cpp b/apps/src/ni_agast.cpp index d5772230..b399ac40 100644 --- a/apps/src/ni_agast.cpp +++ b/apps/src/ni_agast.cpp @@ -38,6 +38,7 @@ */ #define SHOW_FPS 1 + #include #include #include @@ -51,19 +52,23 @@ #include #include +#include +#include + using namespace pcl; using namespace std; +using namespace std::chrono_literals; -typedef PointUV KeyPointT; +using KeyPointT = PointUV; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template class AGASTDemo { public: - typedef PointCloud Cloud; - typedef typename Cloud::Ptr CloudPtr; - typedef typename Cloud::ConstPtr CloudConstPtr; + using Cloud = PointCloud; + using CloudPtr = typename Cloud::Ptr; + using CloudConstPtr = typename Cloud::ConstPtr; AGASTDemo (Grabber& grabber) : cloud_viewer_ ("AGAST 2D Keypoints -- PointCloud") @@ -72,7 +77,6 @@ class AGASTDemo , bmax_ (255) , threshold_ (30) , detector_type_ (0) - , timer_ () { } @@ -81,7 +85,7 @@ class AGASTDemo cloud_callback (const CloudConstPtr& cloud) { FPS_CALC ("cloud callback"); - boost::mutex::scoped_lock lock (cloud_mutex_); + std::lock_guard lock (cloud_mutex_); // Compute AGAST keypoints AgastKeypoint2D agast; @@ -189,8 +193,8 @@ class AGASTDemo void init () { - boost::function cloud_cb = boost::bind (&AGASTDemo::cloud_callback, this, _1); - cloud_connection = grabber_.registerCallback (cloud_cb); + std::function cloud_cb = [this] (const CloudConstPtr& cloud) { cloud_callback (cloud); }; + cloud_connection = grabber_.registerCallback (cloud_cb); } ///////////////////////////////////////////////////////////////////////// @@ -216,12 +220,12 @@ class AGASTDemo keypoints3d.height = keypoints->height; keypoints3d.is_dense = true; - size_t j = 0; - for (size_t i = 0; i < keypoints->size (); ++i) + std::size_t j = 0; + for (std::size_t i = 0; i < keypoints->size (); ++i) { const PointT &pt = (*cloud)(static_cast (keypoints->points[i].u), static_cast (keypoints->points[i].v)); - if (!pcl_isfinite (pt.x) || !pcl_isfinite (pt.y) || !pcl_isfinite (pt.z)) + if (!std::isfinite (pt.x) || !std::isfinite (pt.y) || !std::isfinite (pt.z)) continue; keypoints3d.points[j].x = pt.x; @@ -271,7 +275,7 @@ class AGASTDemo { cloud_viewer_.setPosition (0, 0); cloud_viewer_.setSize (cloud->width, cloud->height); - cloud_init = !cloud_init; + cloud_init = true; } if (!cloud_viewer_.updatePointCloud (cloud, "OpenNICloud")) @@ -284,7 +288,7 @@ class AGASTDemo { image_viewer_.setPosition (cloud->width, 0); image_viewer_.setSize (cloud->width, cloud->height); - image_init = !image_init; + image_init = true; } image_viewer_.addRGBImage (cloud); @@ -292,7 +296,7 @@ class AGASTDemo if (keypoints && !keypoints->empty ()) { image_viewer_.removeLayer (getStrBool (keypts)); - for (size_t i = 0; i < keypoints->size (); ++i) + for (std::size_t i = 0; i < keypoints->size (); ++i) { int u = int (keypoints->points[i].u); int v = int (keypoints->points[i].v); @@ -311,7 +315,7 @@ class AGASTDemo cloud_viewer_.spinOnce (); image_viewer_.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); @@ -320,7 +324,7 @@ class AGASTDemo visualization::PCLVisualizer cloud_viewer_; Grabber& grabber_; - boost::mutex cloud_mutex_; + std::mutex cloud_mutex_; CloudConstPtr cloud_; visualization::ImageViewer image_viewer_; diff --git a/apps/src/ni_brisk.cpp b/apps/src/ni_brisk.cpp index 891a183d..4985435f 100644 --- a/apps/src/ni_brisk.cpp +++ b/apps/src/ni_brisk.cpp @@ -38,6 +38,7 @@ */ #define SHOW_FPS 1 + #include #include #include @@ -51,19 +52,23 @@ #include #include +#include +#include + using namespace pcl; using namespace std; +using namespace std::chrono_literals; -typedef PointXYZRGBA PointT; -typedef PointWithScale KeyPointT; +using PointT = PointXYZRGBA; +using KeyPointT = PointWithScale; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class BRISKDemo { public: - typedef PointCloud Cloud; - typedef Cloud::Ptr CloudPtr; - typedef Cloud::ConstPtr CloudConstPtr; + using Cloud = PointCloud; + using CloudPtr = Cloud::Ptr; + using CloudConstPtr = Cloud::ConstPtr; BRISKDemo (Grabber& grabber) : cloud_viewer_ ("BRISK 2D Keypoints -- PointCloud") @@ -77,7 +82,7 @@ class BRISKDemo cloud_callback (const CloudConstPtr& cloud) { FPS_CALC ("cloud callback"); - boost::mutex::scoped_lock lock (cloud_mutex_); + std::lock_guard lock (cloud_mutex_); cloud_ = cloud; // Compute BRISK keypoints @@ -94,7 +99,7 @@ class BRISKDemo void init () { - boost::function cloud_cb = boost::bind (&BRISKDemo::cloud_callback, this, _1); + std::function cloud_cb = [this] (const CloudConstPtr& cloud) { cloud_callback (cloud); }; cloud_connection = grabber_.registerCallback (cloud_cb); } @@ -179,8 +184,8 @@ class BRISKDemo keypoints3d.height = keypoints->height; keypoints3d.is_dense = true; - size_t j = 0; - for (size_t i = 0; i < keypoints->size (); ++i) + std::size_t j = 0; + for (std::size_t i = 0; i < keypoints->size (); ++i) { PointT pt = bilinearInterpolation (cloud, keypoints->points[i].x, keypoints->points[i].y); @@ -230,7 +235,7 @@ class BRISKDemo { cloud_viewer_.setPosition (0, 0); cloud_viewer_.setSize (cloud->width, cloud->height); - cloud_init = !cloud_init; + cloud_init = true; } if (!cloud_viewer_.updatePointCloud (cloud, "OpenNICloud")) @@ -243,13 +248,13 @@ class BRISKDemo { image_viewer_.setPosition (cloud->width, 0); image_viewer_.setSize (cloud->width, cloud->height); - image_init = !image_init; + image_init = true; } image_viewer_.showRGBImage (cloud); image_viewer_.removeLayer (getStrBool (keypts)); - for (size_t i = 0; i < keypoints->size (); ++i) + for (std::size_t i = 0; i < keypoints->size (); ++i) { int u = int (keypoints->points[i].x); int v = int (keypoints->points[i].y); @@ -268,7 +273,7 @@ class BRISKDemo cloud_viewer_.spinOnce (); image_viewer_.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); @@ -278,7 +283,7 @@ class BRISKDemo visualization::PCLVisualizer cloud_viewer_; Grabber& grabber_; - boost::mutex cloud_mutex_; + std::mutex cloud_mutex_; CloudConstPtr cloud_; visualization::ImageViewer image_viewer_; diff --git a/apps/src/ni_linemod.cpp b/apps/src/ni_linemod.cpp index bc84a7ad..3b000d2e 100644 --- a/apps/src/ni_linemod.cpp +++ b/apps/src/ni_linemod.cpp @@ -50,7 +50,6 @@ #include #include #include -//#include #include #include #include @@ -62,10 +61,14 @@ #include #include +#include +#include + using namespace pcl; using namespace std; +using namespace std::chrono_literals; -typedef PointXYZRGBA PointT; +using PointT = PointXYZRGBA; #define SHOW_FPS 1 @@ -73,9 +76,9 @@ typedef PointXYZRGBA PointT; class NILinemod { public: - typedef PointCloud Cloud; - typedef Cloud::Ptr CloudPtr; - typedef Cloud::ConstPtr CloudConstPtr; + using Cloud = PointCloud; + using CloudPtr = Cloud::Ptr; + using CloudConstPtr = Cloud::ConstPtr; bool added; NILinemod (Grabber& grabber) @@ -107,7 +110,7 @@ class NILinemod cloud_callback (const CloudConstPtr& cloud) { FPS_CALC ("cloud callback"); - boost::mutex::scoped_lock lock (cloud_mutex_); + std::lock_guard lock (cloud_mutex_); cloud_ = cloud; search_.setInputCloud (cloud); @@ -151,16 +154,13 @@ class NILinemod first_frame_ = true; return; } - else - { - plane_.reset (new Cloud); + plane_.reset (new Cloud); - // Compute the convex hull of the plane - ConvexHull chull; - chull.setDimension (2); - chull.setInputCloud (plane_inliers); - chull.reconstruct (*plane_); - } + // Compute the convex hull of the plane + ConvexHull chull; + chull.setDimension (2); + chull.setInputCloud (plane_inliers); + chull.reconstruct (*plane_); } } @@ -169,7 +169,7 @@ class NILinemod getLatestCloud () { // Lock while we swap our cloud and reset it. - boost::mutex::scoped_lock lock (cloud_mutex_); + std::lock_guard lock (cloud_mutex_); CloudConstPtr temp_cloud; temp_cloud.swap (cloud_); return (temp_cloud); @@ -180,13 +180,13 @@ class NILinemod keyboard_callback (const visualization::KeyboardEvent&, void*) { //if (event.getKeyCode()) - // cout << "the key \'" << event.getKeyCode() << "\' (" << event.getKeyCode() << ") was"; + // std::cout << "the key \'" << event.getKeyCode() << "\' (" << event.getKeyCode() << ") was"; //else - // cout << "the special key \'" << event.getKeySym() << "\' was"; + // std::cout << "the special key \'" << event.getKeySym() << "\' was"; //if (event.keyDown()) - // cout << " pressed" << endl; + // std::cout << " pressed" << std::endl; //else - // cout << " released" << endl; + // std::cout << " released" << std::endl; } ///////////////////////////////////////////////////////////////////////// @@ -195,7 +195,7 @@ class NILinemod { //if (mouse_event.getType() == visualization::MouseEvent::MouseButtonPress && mouse_event.getButton() == visualization::MouseEvent::LeftButton) //{ - // cout << "left button pressed @ " << mouse_event.getX () << " , " << mouse_event.getY () << endl; + // std::cout << "left button pressed @ " << mouse_event.getX () << " , " << mouse_event.getY () << std::endl; //} } @@ -256,33 +256,30 @@ class NILinemod Label l; l.label = 0; PointCloud